From 8dcc7aaa98f9ea97df767d85851575a88d57f4bc Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Wed, 30 Apr 2025 16:27:46 +0530 Subject: [PATCH 01/16] Administration: Fix Tags screen 'No tags found' message and tablenav visibility --- src/js/_enqueues/admin/tags.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 3b6cf2b4892e7..cb657410cea83 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -42,7 +42,19 @@ jQuery( function($) { $.post(ajaxurl, data, function(r){ if ( '1' == r ) { $('#ajax-response').empty(); - tr.fadeOut('normal', function(){ tr.remove(); }); + tr.fadeOut('normal', function() { + tr.remove(); + + if ( $('#the-list tr').length === 0 ) { + $('#the-list').append( + '' + + wp.i18n.__( 'No tags found.' ) + + '' + ); + + $('.tablenav').hide(); + } + }); /** * Removes the term from the parent box and the tag cloud. From 338d2c7cb76a6ead43fe959e63d2c2041b4b22de Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Mon, 5 May 2025 22:16:41 +0530 Subject: [PATCH 02/16] Administration: Update tag count display in tablenav after adding/removing tags --- src/js/_enqueues/admin/tags.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index cb657410cea83..1641591ed0137 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -54,6 +54,10 @@ jQuery( function($) { $('.tablenav').hide(); } + + var itemCount = $('#the-list tr').length; + var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); + $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); }); /** @@ -171,6 +175,10 @@ jQuery( function($) { } $('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):visible, textarea:visible', form).val(''); + + var itemCount = $('#the-list tr').length; + var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); + $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); }); return false; From 0577a55b629426ee9e250ce089a54437a10bb8b4 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Mon, 5 May 2025 22:27:17 +0530 Subject: [PATCH 03/16] Administration: Show search box and tablenav when items are present in the tags list --- src/js/_enqueues/admin/tags.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 1641591ed0137..8885eb817340f 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -53,6 +53,7 @@ jQuery( function($) { ); $('.tablenav').hide(); + $('p.search-box').hide(); } var itemCount = $('#the-list tr').length; @@ -179,6 +180,11 @@ jQuery( function($) { var itemCount = $('#the-list tr').length; var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); + + if ( itemCount === 1 ) { + $('.tablenav').show(); + $('p.search-box').show(); + } }); return false; From 9f820be8cc373262a599f7b10b32eccab676a2bc Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Tue, 6 May 2025 09:12:51 +0530 Subject: [PATCH 04/16] Administration: Adjust tag count handling for pagination consistency --- src/js/_enqueues/admin/tags.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 8885eb817340f..b67c196b1e345 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -56,7 +56,8 @@ jQuery( function($) { $('p.search-box').hide(); } - var itemCount = $('#the-list tr').length; + var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; + var itemCount = currentCount - 1 || 0; var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); }); @@ -177,7 +178,8 @@ jQuery( function($) { $('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):visible, textarea:visible', form).val(''); - var itemCount = $('#the-list tr').length; + var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; + var itemCount = currentCount + 1 || 0; var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); From 35f7f4a3304562281a076db11549bac500c7fd39 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Wed, 30 Apr 2025 16:27:46 +0530 Subject: [PATCH 05/16] Administration: Fix Tags screen 'No tags found' message and tablenav visibility --- src/js/_enqueues/admin/tags.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index ff7761adb8d3e..a414baf347f03 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -49,18 +49,19 @@ jQuery( function($) { var message; if ( '1' == r ) { $('#ajax-response').empty(); - let nextFocus = tr.next( 'tr' ).find( 'a.row-title' ); - let prevFocus = tr.prev( 'tr' ).find( 'a.row-title' ); - // If there is neither a next row or a previous row, focus the tag input field. - if ( nextFocus.length < 1 && prevFocus.length < 1 ) { - nextFocus = $( '#tag-name' ).trigger( 'focus' ); - } else { - if ( nextFocus.length < 1 ) { - nextFocus = prevFocus; - } - } + tr.fadeOut('normal', function() { + tr.remove(); + + if ( $('#the-list tr').length === 0 ) { + $('#the-list').append( + '' + + wp.i18n.__( 'No tags found.' ) + + '' + ); - tr.fadeOut('normal', function(){ tr.remove(); }); + $('.tablenav').hide(); + } + }); /** * Removes the term from the parent box and the tag cloud. @@ -73,7 +74,7 @@ jQuery( function($) { $('a.tag-link-' + data.match(/tag_ID=(\d+)/)[1]).remove(); nextFocus.trigger( 'focus' ); message = wp.i18n.__( 'The selected tag has been deleted.' ); - + } else if ( '-1' == r ) { message = wp.i18n.__( 'Sorry, you are not allowed to do that.' ); $('#ajax-response').empty().append('

' + message + '

'); From e9529b38827f5facb87b152e8cc75dcac378ffba Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Mon, 5 May 2025 22:16:41 +0530 Subject: [PATCH 06/16] Administration: Update tag count display in tablenav after adding/removing tags --- src/js/_enqueues/admin/tags.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index a414baf347f03..5f5f0f1128c02 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -61,6 +61,10 @@ jQuery( function($) { $('.tablenav').hide(); } + + var itemCount = $('#the-list tr').length; + var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); + $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); }); /** @@ -193,6 +197,10 @@ jQuery( function($) { } $('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):visible, textarea:visible', form).val(''); + + var itemCount = $('#the-list tr').length; + var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); + $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); }); return false; From 8f1236748a3c9f23a1992c0379bee137988b414e Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Mon, 5 May 2025 22:27:17 +0530 Subject: [PATCH 07/16] Administration: Show search box and tablenav when items are present in the tags list --- src/js/_enqueues/admin/tags.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 5f5f0f1128c02..d29d512fb80ad 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -60,6 +60,7 @@ jQuery( function($) { ); $('.tablenav').hide(); + $('p.search-box').hide(); } var itemCount = $('#the-list tr').length; @@ -201,6 +202,11 @@ jQuery( function($) { var itemCount = $('#the-list tr').length; var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); + + if ( itemCount === 1 ) { + $('.tablenav').show(); + $('p.search-box').show(); + } }); return false; From ae6352a60349ce5225ba8fc773b7250a049124af Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Tue, 6 May 2025 09:12:51 +0530 Subject: [PATCH 08/16] Administration: Adjust tag count handling for pagination consistency --- src/js/_enqueues/admin/tags.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index d29d512fb80ad..37259d4e5b328 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -63,7 +63,8 @@ jQuery( function($) { $('p.search-box').hide(); } - var itemCount = $('#the-list tr').length; + var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; + var itemCount = currentCount - 1 || 0; var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); }); @@ -199,7 +200,8 @@ jQuery( function($) { $('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):visible, textarea:visible', form).val(''); - var itemCount = $('#the-list tr').length; + var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; + var itemCount = currentCount + 1 || 0; var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); From eeb7d1a428821fa53f2443e6f62cf2824f5aafda Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Fri, 31 Oct 2025 16:20:04 -0500 Subject: [PATCH 09/16] Restore focus management PR removed this; needed for accessibility. --- src/js/_enqueues/admin/tags.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 37259d4e5b328..52a74d382518a 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -49,6 +49,16 @@ jQuery( function($) { var message; if ( '1' == r ) { $('#ajax-response').empty(); + let nextFocus = tr.next( 'tr' ).find( 'a.row-title' ); + let prevFocus = tr.prev( 'tr' ).find( 'a.row-title' ); + // If there is neither a next row or a previous row, focus the tag input field. + if ( nextFocus.length < 1 && prevFocus.length < 1 ) { + nextFocus = $( '#tag-name' ).trigger( 'focus' ); + } else { + if ( nextFocus.length < 1 ) { + nextFocus = prevFocus; + } + } tr.fadeOut('normal', function() { tr.remove(); From d3145cd437684764bc1ff21702bf04c7ab436904 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Fri, 31 Oct 2025 16:44:40 -0500 Subject: [PATCH 10/16] Use `wp.i18n._n` to handle singular/plural translations. --- src/js/_enqueues/admin/tags.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 52a74d382518a..5e995b45c2fd7 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -75,8 +75,8 @@ jQuery( function($) { var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; var itemCount = currentCount - 1 || 0; - var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); - $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); + var itemText = wp.i18n._n( '%d item', '%d items', itemCount ); + $('.tablenav-pages .displaying-num').text( itemText ); }); /** @@ -212,8 +212,8 @@ jQuery( function($) { var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; var itemCount = currentCount + 1 || 0; - var itemText = itemCount === 1 ? wp.i18n.__('item') : wp.i18n.__('items'); - $('.tablenav-pages .displaying-num').text( itemCount + ' ' + itemText); + var itemText = wp.i18n._n( '%d item', '%d items', itemCount ); + $('.tablenav-pages .displaying-num').text( itemText ); if ( itemCount === 1 ) { $('.tablenav').show(); From 3cc5625fe6c0592d296ea1578fd425b6465f859d Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Fri, 31 Oct 2025 16:59:19 -0500 Subject: [PATCH 11/16] Don't duplicate table nav update code Simplifies and avoids repetition. --- src/js/_enqueues/admin/tags.js | 54 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 5e995b45c2fd7..e00235496c8e1 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -61,22 +61,7 @@ jQuery( function($) { } tr.fadeOut('normal', function() { tr.remove(); - - if ( $('#the-list tr').length === 0 ) { - $('#the-list').append( - '' + - wp.i18n.__( 'No tags found.' ) + - '' - ); - - $('.tablenav').hide(); - $('p.search-box').hide(); - } - - var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; - var itemCount = currentCount - 1 || 0; - var itemText = wp.i18n._n( '%d item', '%d items', itemCount ); - $('.tablenav-pages .displaying-num').text( itemText ); + updateTableNavCount(); }); /** @@ -120,6 +105,33 @@ jQuery( function($) { tr.find( ':input, a' ).prop( 'disabled', false ).removeAttr( 'tabindex' ); } + /** + * Update the row count for table navigation.. + * + * @return {void} + */ + function updateTableNavCount( action = 'remove' ) { + var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; + var itemCount = ( 'remove' === action ) ? currentCount - 1 || 0 : currentCount + 1; + var itemText = wp.i18n.sprintf( wp.i18n._n( '%d item', '%d items', itemCount ), itemCount ); + $('.tablenav-pages .displaying-num').text( itemText ); + // Show the tablenav if row count positive. + if ( itemCount === 1 ) { + $('.tablenav').show(); + $('p.search-box').show(); + } + if ( $('#the-list tr').length === 0 ) { + $('#the-list').append( + '' + + wp.i18n.__( 'No tags found.' ) + + '' + ); + + $('.tablenav').hide(); + $('p.search-box').hide(); + } + } + /** * Adds a deletion confirmation when removing a tag. * @@ -210,15 +222,7 @@ jQuery( function($) { $('input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):visible, textarea:visible', form).val(''); - var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; - var itemCount = currentCount + 1 || 0; - var itemText = wp.i18n._n( '%d item', '%d items', itemCount ); - $('.tablenav-pages .displaying-num').text( itemText ); - - if ( itemCount === 1 ) { - $('.tablenav').show(); - $('p.search-box').show(); - } + updateTableNavCount( 'add' ); }); return false; From b8818c3dca8b1ddb00432f21a3ae064889359360 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Mon, 13 Jul 2026 21:08:52 +0530 Subject: [PATCH 12/16] Administration: Fix empty-state colspan and i18n count parsing in tags table --- src/js/_enqueues/admin/tags.js | 49 ++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index e00235496c8e1..5ec596bb9513f 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -106,29 +106,44 @@ jQuery( function($) { } /** - * Update the row count for table navigation.. + * Updates the item count and table navigation after a tag is added or removed. + * + * Tags are added and removed client-side, but the item count, the `.tablenav` + * regions, the search box, and the empty-state row are otherwise only + * reconciled by PHP on a full page reload. This keeps them in sync. + * + * @param {string} [action] Pass 'add' when a tag was added. Any other value, + * including none, is treated as a removal. * * @return {void} */ - function updateTableNavCount( action = 'remove' ) { - var currentCount = parseInt( $('.tablenav-pages .displaying-num').first().text().match(/\d+/) ) || 0; - var itemCount = ( 'remove' === action ) ? currentCount - 1 || 0 : currentCount + 1; - var itemText = wp.i18n.sprintf( wp.i18n._n( '%d item', '%d items', itemCount ), itemCount ); - $('.tablenav-pages .displaying-num').text( itemText ); - // Show the tablenav if row count positive. - if ( itemCount === 1 ) { - $('.tablenav').show(); - $('p.search-box').show(); - } - if ( $('#the-list tr').length === 0 ) { - $('#the-list').append( - '' + + function updateTableNavCount( action ) { + var $displayingNum = $( '.tablenav-pages .displaying-num' ), + currentCount = parseInt( $displayingNum.first().text().replace( /[^0-9]/g, '' ), 10 ) || 0, + itemCount = ( 'add' === action ) ? currentCount + 1 : Math.max( currentCount - 1, 0 ); + + $displayingNum.text( + wp.i18n.sprintf( + /* translators: %s: Number of items. */ + wp.i18n._n( '%s item', '%s items', itemCount ), + itemCount + ) + ); + + if ( itemCount < 1 ) { + // No tags remain: show the empty-state row and hide the navigation. + var colspan = $( '#the-list' ).closest( 'table' ).find( 'thead > tr' ).first().children( ':not(.hidden)' ).length; + + $( '#the-list' ).append( + '' + wp.i18n.__( 'No tags found.' ) + '' ); - - $('.tablenav').hide(); - $('p.search-box').hide(); + $( '.tablenav' ).hide(); + $( 'p.search-box' ).hide(); + } else { + $( '.tablenav' ).show(); + $( 'p.search-box' ).show(); } } From 5d1340dcbfb162a2a96d88911d611c7c2eb2535c Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Tue, 21 Jul 2026 11:31:09 -0500 Subject: [PATCH 13/16] Update src/js/_enqueues/admin/tags.js Co-authored-by: Khokan Sardar --- src/js/_enqueues/admin/tags.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 5ec596bb9513f..a1541d181c4bf 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -105,6 +105,21 @@ jQuery( function($) { tr.find( ':input, a' ).prop( 'disabled', false ).removeAttr( 'tabindex' ); } + /** + * Updates the item count and table navigation after a tag is added or removed. + * + * Tags are added and removed client-side, but the item count, the `.tablenav` + * regions, the search box, and the empty-state row are otherwise only + * reconciled by PHP on a full page reload. This keeps them in sync. + * + * @param {string} [action] Pass 'add' when a tag was added. Any other value, + * including none, is treated as a removal. + * + * @return {void} + */ + function updateTableNavCount( action ) { + var $displayingNum = $( '.tablenav-pages .displaying-num' ), + currentCount = parseInt( $displayingNum.first().text().replace( /[^0-9]/g, '' ), 10 ) || 0, /** * Updates the item count and table navigation after a tag is added or removed. * From e11a0f789026032666bb4650428283c31e071b17 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Tue, 21 Jul 2026 16:42:19 -0500 Subject: [PATCH 14/16] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/js/_enqueues/admin/tags.js | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index a1541d181c4bf..5ec596bb9513f 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -105,21 +105,6 @@ jQuery( function($) { tr.find( ':input, a' ).prop( 'disabled', false ).removeAttr( 'tabindex' ); } - /** - * Updates the item count and table navigation after a tag is added or removed. - * - * Tags are added and removed client-side, but the item count, the `.tablenav` - * regions, the search box, and the empty-state row are otherwise only - * reconciled by PHP on a full page reload. This keeps them in sync. - * - * @param {string} [action] Pass 'add' when a tag was added. Any other value, - * including none, is treated as a removal. - * - * @return {void} - */ - function updateTableNavCount( action ) { - var $displayingNum = $( '.tablenav-pages .displaying-num' ), - currentCount = parseInt( $displayingNum.first().text().replace( /[^0-9]/g, '' ), 10 ) || 0, /** * Updates the item count and table navigation after a tag is added or removed. * From c23797559f95807562f6c369218d1dc85a1a4a12 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 23 Jul 2026 17:42:26 -0500 Subject: [PATCH 15/16] Allow count & bulk actions to show on first add. Renders bulk actions in a `hidden` state when no items, so they're available immediately. Impacts all list table screens, but I don't think it should have any significant impact. Fixes counts to use formatted count, hides only elements inside `.tablenav` so that the tablenav spacing is left intact, avoiding the 32px shift when it's removed. --- src/js/_enqueues/admin/tags.js | 27 +++++++++++-------- src/wp-admin/includes/class-wp-list-table.php | 13 ++++++--- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js index 5ec596bb9513f..88e38b6926309 100644 --- a/src/js/_enqueues/admin/tags.js +++ b/src/js/_enqueues/admin/tags.js @@ -120,29 +120,34 @@ jQuery( function($) { function updateTableNavCount( action ) { var $displayingNum = $( '.tablenav-pages .displaying-num' ), currentCount = parseInt( $displayingNum.first().text().replace( /[^0-9]/g, '' ), 10 ) || 0, - itemCount = ( 'add' === action ) ? currentCount + 1 : Math.max( currentCount - 1, 0 ); + itemCount = ( 'add' === action ) ? currentCount + 1 : Math.max( currentCount - 1, 0 ), + formattedCount = itemCount.toLocaleString(); $displayingNum.text( wp.i18n.sprintf( /* translators: %s: Number of items. */ wp.i18n._n( '%s item', '%s items', itemCount ), - itemCount + formattedCount ) ); if ( itemCount < 1 ) { // No tags remain: show the empty-state row and hide the navigation. - var colspan = $( '#the-list' ).closest( 'table' ).find( 'thead > tr' ).first().children( ':not(.hidden)' ).length; - - $( '#the-list' ).append( - '' + - wp.i18n.__( 'No tags found.' ) + - '' - ); - $( '.tablenav' ).hide(); + var $list = $( '#the-list' ); + + if ( ! $list.find( 'tr.no-items' ).length ) { + var colspan = $list.closest( 'table' ).find( 'thead > tr' ).first().children( ':not(.hidden)' ).length; + $list.append( + '' + + wp.i18n.__( 'No tags found.' ) + + '' + ); + } + $( '.tablenav > *' ).hide(); $( 'p.search-box' ).hide(); } else { - $( '.tablenav' ).show(); + $( '#the-list' ).find( 'tr.no-items' ).remove(); + $( '.tablenav > *' ).show(); $( 'p.search-box' ).show(); } } diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index b78af78abc03e..2ac72278c97c4 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -1029,6 +1029,7 @@ protected function get_items_per_page( $option, $default_value = 20 ) { */ protected function pagination( $which ) { if ( empty( $this->_pagination_args['total_items'] ) ) { + echo '
0 items
'; return; } @@ -1685,12 +1686,16 @@ protected function display_tablenav( $which ) { ?>
- has_items() ) : ?> -
+ has_items() ) { + $visibility = ''; + } + ?> +
bulk_actions( $which ); ?>
- extra_tablenav( $which ); $this->pagination( $which ); ?> From 74a9b4d6bc2b19b7bcad66488e3b2f7308704bcc Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 23 Jul 2026 17:44:21 -0500 Subject: [PATCH 16/16] Translatable & comment I meant to fix that before committing. --- src/wp-admin/includes/class-wp-list-table.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 2ac72278c97c4..6ebae0e98eb86 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -1029,7 +1029,8 @@ protected function get_items_per_page( $option, $default_value = 20 ) { */ protected function pagination( $which ) { if ( empty( $this->_pagination_args['total_items'] ) ) { - echo '
0 items
'; + // translators: Number is a fixed value. This is default text when no items are found. + echo '
' . __( '0 items' ) . '
'; return; }