In the form handler logic for edit-tags.php, don't redirect until $_REQUEST['paged'] has been checked. All switch cases (except edit) now use break instead of exit.

Fixes #16162.

Built from https://develop.svn.wordpress.org/trunk@29782


git-svn-id: http://core.svn.wordpress.org/trunk@29554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-09-29 04:54:16 +00:00
parent 37a0c36d38
commit 1595d6a20c

View File

@ -38,6 +38,8 @@ if ( 'post' != $post_type ) {
add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) ); add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) );
$location = false;
switch ( $wp_list_table->current_action() ) { switch ( $wp_list_table->current_action() ) {
case 'add-tag': case 'add-tag':
@ -61,8 +63,8 @@ case 'add-tag':
$location = add_query_arg( 'message', 1, $location ); $location = add_query_arg( 'message', 1, $location );
else else
$location = add_query_arg( 'message', 4, $location ); $location = add_query_arg( 'message', 4, $location );
wp_redirect( $location );
exit; break;
case 'delete': case 'delete':
$location = 'edit-tags.php?taxonomy=' . $taxonomy; $location = 'edit-tags.php?taxonomy=' . $taxonomy;
@ -74,8 +76,7 @@ case 'delete':
} }
if ( ! isset( $_REQUEST['tag_ID'] ) ) { if ( ! isset( $_REQUEST['tag_ID'] ) ) {
wp_redirect( $location ); break;
exit;
} }
$tag_ID = (int) $_REQUEST['tag_ID']; $tag_ID = (int) $_REQUEST['tag_ID'];
@ -87,8 +88,8 @@ case 'delete':
wp_delete_term( $tag_ID, $taxonomy ); wp_delete_term( $tag_ID, $taxonomy );
$location = add_query_arg( 'message', 2, $location ); $location = add_query_arg( 'message', 2, $location );
wp_redirect( $location );
exit; break;
case 'bulk-delete': case 'bulk-delete':
check_admin_referer( 'bulk-tags' ); check_admin_referer( 'bulk-tags' );
@ -110,8 +111,8 @@ case 'bulk-delete':
} }
$location = add_query_arg( 'message', 6, $location ); $location = add_query_arg( 'message', 6, $location );
wp_redirect( $location );
exit; break;
case 'edit': case 'edit':
$title = $tax->labels->edit_item; $title = $tax->labels->edit_item;
@ -123,8 +124,9 @@ case 'edit':
wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) );
require_once( ABSPATH . 'wp-admin/admin-header.php' ); require_once( ABSPATH . 'wp-admin/admin-header.php' );
include( ABSPATH . 'wp-admin/edit-tag-form.php' ); include( ABSPATH . 'wp-admin/edit-tag-form.php' );
include( ABSPATH . 'wp-admin/admin-footer.php' );
break; exit;
case 'editedtag': case 'editedtag':
$tag_ID = (int) $_POST['tag_ID']; $tag_ID = (int) $_POST['tag_ID'];
@ -152,17 +154,17 @@ case 'editedtag':
$location = add_query_arg( 'message', 3, $location ); $location = add_query_arg( 'message', 3, $location );
else else
$location = add_query_arg( 'message', 5, $location ); $location = add_query_arg( 'message', 5, $location );
break;
}
wp_redirect( $location ); if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) {
exit;
default:
if ( ! empty($_REQUEST['_wp_http_referer']) ) {
$location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ); $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) );
}
if ( ! empty( $_REQUEST['paged'] ) ) if ( $location ) {
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'] ); if ( ! empty( $_REQUEST['paged'] ) ) {
$location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
}
wp_redirect( $location ); wp_redirect( $location );
exit; exit;
} }
@ -583,10 +585,7 @@ do_action( "{$taxonomy}_add_form", $taxonomy );
<script type="text/javascript"> <script type="text/javascript">
try{document.forms.addtag['tag-name'].focus();}catch(e){} try{document.forms.addtag['tag-name'].focus();}catch(e){}
</script> </script>
<?php $wp_list_table->inline_edit(); ?>
<?php <?php
break; $wp_list_table->inline_edit();
}
include( ABSPATH . 'wp-admin/admin-footer.php' ); include( ABSPATH . 'wp-admin/admin-footer.php' );