Skip to content

Commit

Permalink
Administration: Fix pagination in categories, tags, and plugins tables.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aaronjorbin committed Feb 4, 2025
1 parent eb3c379 commit 2f2c858
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/js/_enqueues/admin/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
3 changes: 3 additions & 0 deletions src/wp-admin/edit-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2f2c858

Please sign in to comment.