Repository navigation
Plugins: Update custom plugin group counts after deleting a plugin. - #14675
huzaifaalmesbah wants to merge 4 commits into
Conversation
Groups added through the `plugins_list` filter now have their count lowered when a plugin in them is deleted, and their tab is removed once they are empty. See #65191.
|
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. |
…ew is removed. See #65191.
…es.decrementCount()`. Follow-up to [40025]. See #65191.
Description
This is a refresh of #11777, the original PR by @alessioarzenton, scoped to the count fix and the separator it leaves behind.
wp.updates.deletePluginSuccess()only updates the counts of the groups Core knows about (Active, Inactive, Recently Active and the auto-update groups). A group added through theplugins_listfilter, with its label fromplugins_list_status_text(#60495), keeps its old count after a plugin is deleted, until the page is reloaded.After the existing blocks, this goes through the other keys in
settings.plugins. When a custom group holds the deleted plugin, its count goes down, and its tab is removed once it is empty. Core groups keep their own code paths, so nothing changes for them. The group key is escaped with$.escapeSelector()before it is used in a selector, sinceplugins_listkeys can contain characters such as.or:.Since custom groups come after the Core ones, they are usually the last view.
WP_List_Table::views()puts the|separator inside every view but the last, so removing the last view left a trailing|on the one before it. After the views are updated, the trailing separator is now removed from the new last view, the same waywp.updates.decrementCount()has done for the Update Available view since r40025. This also covers Core views that are removed while last, which had the same leftover|before.Changes from #11777:
|separator fromWP_List_Table::views()to CSS is left out. Core still hardcodes|in other.subsubsublists (wp_network_dashboard_right_now()and the media upload filters), so the new CSS rule would show a double separator there. The leftover separator is removed in JavaScript instead, which leaves the markup unchanged.Testing Instructions
a.a, and one that doesn't.aplugins from its row actions.|left after the view before it.QUnit:
The new test is "Deleting a plugin should update the counts of custom plugin groups" in
tests/qunit/wp-admin/js/updates.js. It fails without the change toupdates.js.Screenshots
Deleting a plugin from the Demo Group view. Before, the tab and the item count keep the old numbers until a reload. After, both go down right away.
Deleting the last plugin of the last custom group. Without the separator cleanup, a
|is left after the new last view. With it, the list ends cleanly.Trac ticket: https://core.trac.wordpress.org/ticket/65191
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Code archaeology, brainstorming reproduction steps, and drafting initial diffs; root-cause diagnosis, implementation, and test verification were performed and verified by me.