From 1595d6a20c20afcf87201cebb8c68cb8cd40753d Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 29 Sep 2014 04:54:16 +0000 Subject: [PATCH] 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 --- wp-admin/edit-tags.php | 43 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php index 953f6f430c..6c5ace039c 100644 --- a/wp-admin/edit-tags.php +++ b/wp-admin/edit-tags.php @@ -38,6 +38,8 @@ if ( 'post' != $post_type ) { add_screen_option( 'per_page', array( 'label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) ); +$location = false; + switch ( $wp_list_table->current_action() ) { case 'add-tag': @@ -61,8 +63,8 @@ case 'add-tag': $location = add_query_arg( 'message', 1, $location ); else $location = add_query_arg( 'message', 4, $location ); - wp_redirect( $location ); - exit; + + break; case 'delete': $location = 'edit-tags.php?taxonomy=' . $taxonomy; @@ -73,9 +75,8 @@ case 'delete': $location = $referer; } - if ( !isset( $_REQUEST['tag_ID'] ) ) { - wp_redirect( $location ); - exit; + if ( ! isset( $_REQUEST['tag_ID'] ) ) { + break; } $tag_ID = (int) $_REQUEST['tag_ID']; @@ -87,8 +88,8 @@ case 'delete': wp_delete_term( $tag_ID, $taxonomy ); $location = add_query_arg( 'message', 2, $location ); - wp_redirect( $location ); - exit; + + break; case 'bulk-delete': check_admin_referer( 'bulk-tags' ); @@ -110,8 +111,8 @@ case 'bulk-delete': } $location = add_query_arg( 'message', 6, $location ); - wp_redirect( $location ); - exit; + + break; case 'edit': $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?' ) ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); include( ABSPATH . 'wp-admin/edit-tag-form.php' ); + include( ABSPATH . 'wp-admin/admin-footer.php' ); -break; + exit; case 'editedtag': $tag_ID = (int) $_POST['tag_ID']; @@ -152,17 +154,17 @@ case 'editedtag': $location = add_query_arg( 'message', 3, $location ); else $location = add_query_arg( 'message', 5, $location ); + break; +} - wp_redirect( $location ); - exit; - -default: -if ( ! empty($_REQUEST['_wp_http_referer']) ) { +if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ); +} - if ( ! empty( $_REQUEST['paged'] ) ) - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'] ); - +if ( $location ) { + if ( ! empty( $_REQUEST['paged'] ) ) { + $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); + } wp_redirect( $location ); exit; } @@ -583,10 +585,7 @@ do_action( "{$taxonomy}_add_form", $taxonomy ); -inline_edit(); ?> - inline_edit(); include( ABSPATH . 'wp-admin/admin-footer.php' );