mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-23 00:31:28 +01:00
Fix redirects after editing and deleting link categories.
git-svn-id: http://svn.automattic.com/wordpress/trunk@7537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8c42926dee
commit
b39d0790ec
@ -18,7 +18,14 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
wp_delete_term($cat_ID, 'link_category');
|
||||
}
|
||||
|
||||
wp_redirect('edit-link-categories.php?message=6');
|
||||
$location = 'edit-link-categories.php';
|
||||
if ( $referer = wp_get_referer() ) {
|
||||
if ( false !== strpos($referer, 'edit-link-categories.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
$location = add_query_arg('message', 6, $location);
|
||||
wp_redirect($location);
|
||||
exit();
|
||||
} elseif ( !empty($_GET['_wp_http_referer']) ) {
|
||||
wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
|
||||
|
@ -22,7 +22,7 @@ if ( ! empty($cat_ID) ) {
|
||||
<?php echo $form ?>
|
||||
<input type="hidden" name="action" value="<?php echo $action ?>" />
|
||||
<input type="hidden" name="cat_ID" value="<?php echo $category->term_id ?>" />
|
||||
<?php wp_nonce_field($nonce_action); ?>
|
||||
<?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
|
||||
<table class="form-table">
|
||||
<tr class="form-field form-required">
|
||||
<th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th>
|
||||
|
@ -35,7 +35,15 @@ case 'delete':
|
||||
|
||||
wp_delete_term($cat_ID, 'link_category');
|
||||
|
||||
wp_redirect('edit-link-categories.php?message=2');
|
||||
$location = 'edit-link-categories.php';
|
||||
if ( $referer = wp_get_original_referer() ) {
|
||||
if ( false !== strpos($referer, 'edit-link-categories.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
$location = add_query_arg('message', 2, $location);
|
||||
|
||||
wp_redirect($location);
|
||||
exit;
|
||||
|
||||
break;
|
||||
@ -59,11 +67,18 @@ case 'editedcat':
|
||||
if ( !current_user_can('manage_categories') )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
if ( wp_update_term($cat_ID, 'link_category', $_POST) )
|
||||
wp_redirect('edit-link-categories.php?message=3');
|
||||
else
|
||||
wp_redirect('edit-link-categories.php?message=5');
|
||||
$location = 'edit-link-categories.php';
|
||||
if ( $referer = wp_get_original_referer() ) {
|
||||
if ( false !== strpos($referer, 'edit-link-categories.php') )
|
||||
$location = $referer;
|
||||
}
|
||||
|
||||
if ( wp_update_term($cat_ID, 'link_category', $_POST) )
|
||||
$location = add_query_arg('message', 3, $location);
|
||||
else
|
||||
$location = add_query_arg('message', 5, $location);
|
||||
|
||||
wp_redirect($location);
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user