From cf14d8a2a2ad692b744216046ecea2c0210ef8d8 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Fri, 7 Oct 2016 20:05:45 +0000 Subject: [PATCH] Taxonomy: Remove `paged` argument from referer and add it only if current page is greater than 1. Props swissspidy. See #38194. git-svn-id: https://develop.svn.wordpress.org/trunk@38752 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-tags.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php index 10e05adb4c..2d8707fd32 100644 --- a/src/wp-admin/edit-tags.php +++ b/src/wp-admin/edit-tags.php @@ -64,7 +64,7 @@ $referer = wp_get_referer(); if ( ! $referer ) { // For POST requests. $referer = wp_unslash( $_SERVER['REQUEST_URI'] ); } -$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message' ), $referer ); +$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer ); switch ( $wp_list_table->current_action() ) { @@ -195,7 +195,9 @@ if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { } if ( $location ) { - $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages. + if ( $pagenum > 1 ) { + $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages. + } /** * Filters the taxonomy redirect destination URL.