Skip to content

Commit 382211a

Browse files
committed
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. Props ffffelix, im3dabasia1, apermo, rishavdutta, joedolson, swissspidy, jorbin, joedolson. Fixes #62534. git-svn-id: https://develop.svn.wordpress.org/trunk@59727 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8246f31 commit 382211a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/js/_enqueues/admin/common.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,10 +1310,19 @@ $( function() {
13101310
$document.trigger( 'wp-notice-added' );
13111311
};
13121312

1313+
// Stores initial pagination value for comparison.
1314+
var initialPagedValue = document.querySelector( '#current-page-selector' ).value;
1315+
13131316
$( '.bulkactions' ).parents( 'form' ).on( 'submit', function( event ) {
13141317
var form = this,
13151318
submitterName = event.originalEvent && event.originalEvent.submitter ? event.originalEvent.submitter.name : false;
13161319

1320+
var currentPagedValue = form.querySelector( '#current-page-selector' ).value;
1321+
1322+
if ( initialPagedValue !== currentPagedValue ) {
1323+
return; // Pagination form submission.
1324+
}
1325+
13171326
// Observe submissions from posts lists for 'bulk_action' or users lists for 'new_role'.
13181327
var bulkFieldRelations = {
13191328
'bulk_action' : 'action',

src/wp-admin/edit-tags.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@
216216
if ( $pagenum > 1 ) {
217217
$location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages.
218218
}
219+
if ( 1 === $pagenum ) {
220+
$location = remove_query_arg( 'paged', $location );
221+
}
219222

220223
/**
221224
* Filters the taxonomy redirect destination URL.

0 commit comments

Comments
 (0)