Redirect properly on categories listing page, props Viper007Bond, fixes #8837

git-svn-id: https://develop.svn.wordpress.org/trunk@10344 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-01-10 14:34:04 +00:00
parent 93ce89d4b6
commit d66921d5a3
1 changed files with 8 additions and 10 deletions

View File

@ -25,11 +25,11 @@ case 'addcat':
if ( !current_user_can('manage_categories') ) if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?')); wp_die(__('Cheatin’ uh?'));
if( wp_insert_category($_POST ) ) { if ( wp_insert_category($_POST ) )
wp_redirect('categories.php?message=1#addcat'); wp_safe_redirect( add_query_arg( 'message', 1, wp_get_referer() ) . '#addcat' );
} else { else
wp_redirect('categories.php?message=4#addcat'); wp_safe_redirect( add_query_arg( 'message', 4, wp_get_referer() ) . '#addcat' );
}
exit; exit;
break; break;
@ -43,12 +43,12 @@ case 'delete':
$cat_name = get_catname($cat_ID); $cat_name = get_catname($cat_ID);
// Don't delete the default cats. // Don't delete the default cats.
if ( $cat_ID == get_option('default_category') ) if ( $cat_ID == get_option('default_category') )
wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name)); wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_delete_category($cat_ID); wp_delete_category($cat_ID);
wp_redirect('categories.php?message=2'); wp_safe_redirect( add_query_arg( 'message', 2, wp_get_referer() ) );
exit; exit;
break; break;
@ -69,9 +69,7 @@ case 'bulk-delete':
wp_delete_category($cat_ID); wp_delete_category($cat_ID);
} }
$sendback = wp_get_referer(); wp_safe_redirect( wp_get_referer() );
wp_redirect($sendback);
exit(); exit();
break; break;