Repository navigation
Administration: Use the taxonomy's not_found label when the last term is deleted via AJAX. - #15966
umeshnevase wants to merge 1 commit into
Conversation
…rm is deleted via AJAX. When the last term in a taxonomy list table was removed with the AJAX Delete link, `tags.js` inserted an empty-state row with the hardcoded string "No tags found.". This was shown for every taxonomy, so Categories and custom taxonomies displayed the wrong message until the page was reloaded, when `WP_Terms_List_Table::no_items()` printed the correct label. Localize the current taxonomy's `not_found` label for the `admin-tags` script on `edit-tags.php` and use it for the empty-state row. The label is inserted as text, because it is filterable and may contain markup. If the data is missing, fall back to a generic "No items found." string. Adds an end-to-end test that deletes the last matching term on the Categories and Tags screens and checks the empty-state message.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/66693
Summary
When the last term in a taxonomy list table was removed with the AJAX Delete link,
tags.jsinserted an empty-state row with the hardcoded string "No tags found.". This was shown for every taxonomy, so Categories and custom taxonomies displayed the wrong message until the page was reloaded, whenWP_Terms_List_Table::no_items()printed the correct label.Localize the current taxonomy's
not_foundlabel for theadmin-tagsscript onedit-tags.phpand use it for the empty-state row. The label is inserted as text, because it is filterable and may contain markup. If the data is missing, fall back to a generic "No items found." string.Adds an end-to-end test that deletes the last matching term on the Categories and Tags screens and checks the empty-state message.
After [62843] (#63372), deleting the last term in a taxonomy list table via the AJAX Delete link inserts an empty-state row with the hardcoded string "No tags found.". This is shown for every taxonomy, so Categories and custom taxonomies display the wrong message until the page is reloaded. On a reload,
WP_Terms_List_Table::no_items()prints the taxonomy'slabels->not_found.Changes
src/wp-admin/edit-tags.php: localize the current taxonomy'snot_foundlabel astagsL10n.notFoundfor theadmin-tagsscript.src/js/_enqueues/admin/tags.js: build the empty-state row with that label instead of the hardcoded string..text(), because it is filterable and may contain markup.tests/e2e/specs/taxonomies.test.js: new test that deletes the last matching term on the Categories and Tags screens and checks the empty-state message.Testing instructions
/wp-admin/edit-tags.php?taxonomy=category).not_foundlabel (should show that label).After fix:
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Locating the cause of the wrong empty-state message, drafting the fix in
tags.jsandedit-tags.php, drafting the e2e test, and drafting this description. I reviewed and tested the changes myself before submitting.