From 2f2c8585fb2f4fa7de381df8117e2305fd9fe0d4 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Tue, 4 Feb 2025 03:24:19 +0000 Subject: [PATCH] Administration: Fix pagination in categories, tags, and plugins tables. Fix an issue introduced in [59134] that prevented manual entry of a page number in the pagination input field from navigating pages. Requiring validation of the bulk actions input also impacted other inputs nested in the same form. Also fixes a pre-existing bug where it was not possible to navigate to page 1 using the input field. Reviewed by jorbin. Merges [59727] and [59746] to the 6.7 branch. Props ffffelix, im3dabasia1, apermo, rishavdutta, joedolson, swissspidy, jorbin, joedolson, tobiasbg, mamaduka. Fixes #62534. git-svn-id: https://develop.svn.wordpress.org/branches/6.7@59759 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/common.js | 7 ++++++- src/wp-admin/edit-tags.php | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js index 1aa35a37dba29..590796f4b2a04 100644 --- a/src/js/_enqueues/admin/common.js +++ b/src/js/_enqueues/admin/common.js @@ -1312,7 +1312,12 @@ $( function() { $( '.bulkactions' ).parents( 'form' ).on( 'submit', function( event ) { var form = this, - submitterName = event.originalEvent && event.originalEvent.submitter ? event.originalEvent.submitter.name : false; + submitterName = event.originalEvent && event.originalEvent.submitter ? event.originalEvent.submitter.name : false, + currentPageSelector = form.querySelector( '#current-page-selector' ); + + if ( currentPageSelector && currentPageSelector.defaultValue !== currentPageSelector.value ) { + return; // Pagination form submission. + } // Observe submissions from posts lists for 'bulk_action' or users lists for 'new_role'. var bulkFieldRelations = { diff --git a/src/wp-admin/edit-tags.php b/src/wp-admin/edit-tags.php index a0a38d917d594..74381c0ec8d25 100644 --- a/src/wp-admin/edit-tags.php +++ b/src/wp-admin/edit-tags.php @@ -216,6 +216,9 @@ if ( $pagenum > 1 ) { $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages. } + if ( 1 === $pagenum ) { + $location = remove_query_arg( 'paged', $location ); + } /** * Filters the taxonomy redirect destination URL.