Fix redirects after editing and deleting tags.

git-svn-id: http://svn.automattic.com/wordpress/trunk@7536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-26 21:54:02 +00:00
parent fccd2c132e
commit 8c42926dee
2 changed files with 21 additions and 6 deletions

View File

@ -22,7 +22,7 @@ if ( ! empty($tag_ID) ) {
<?php echo $form ?>
<input type="hidden" name="action" value="<?php echo $action ?>" />
<input type="hidden" name="tag_ID" value="<?php echo $tag->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('Tag name') ?></label></th>

View File

@ -52,7 +52,14 @@ case 'bulk-delete':
wp_delete_term( $tag_ID, 'post_tag');
}
wp_redirect('edit-tags.php?message=6');
$location = 'edit-tags.php';
if ( $referer = wp_get_referer() ) {
if ( false !== strpos($referer, 'edit-tags.php') )
$location = $referer;
}
$location = add_query_arg('message', 6, $location);
wp_redirect($location);
exit;
break;
@ -75,11 +82,19 @@ case 'editedtag':
wp_die(__('Cheatin&#8217; uh?'));
$ret = wp_update_term($tag_ID, 'post_tag', $_POST);
if( $ret && !is_wp_error( $ret ) ) {
wp_redirect('edit-tags.php?message=3');
} else {
wp_redirect('edit-tags.php?message=5');
$location = 'edit-tags.php';
if ( $referer = wp_get_original_referer() ) {
if ( false !== strpos($referer, 'edit-tags.php') )
$location = $referer;
}
if ( $ret && !is_wp_error( $ret ) )
$location = add_query_arg('message', 3, $location);
else
$location = add_query_arg('message', 5, $location);
wp_redirect($location);
exit;
break;