Opened 5 weeks ago
Last modified 3 weeks ago
#65430 new enhancement
Allow deleting an active plugin in one step from the Plugins screen
| Reported by: | yani.iliev | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Plugins | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
Right now the Plugins screen hides the Delete action for any active plugin, so removing one is a two-step job: deactivate, then delete. A plugin folder can be removed directly over SFTP or with WP-CLI, which makes the UI rule look like a workflow choice rather than a hard technical limit.
Why the rule exists: hiding Delete on active plugins was a deliberate guard against accidental one-click deletion of a running plugin (see the related discussion in #5625), and deactivating first lets register_deactivation_hook callbacks run their cleanup (cron events, rewrite rules, transients) before the uninstall routine and the files are removed.
Proposal: keep that safety, drop the friction. Let the Plugins screen delete an active plugin in a single action by deactivating it internally first (firing the normal deactivation hooks), then running the existing uninstall routine, then removing the files. The outcome is identical to today's two clicks, with a confirmation step that covers the accidental-click concern.
Right now the Plugins screen hides the Delete action for any active plugin, so removing one is a two-step job: deactivate, then delete. A plugin folder can be removed directly over SFTP or with WP-CLI, which makes the UI rule look like a workflow choice rather than a hard technical limit.
Why the rule exists: hiding Delete on active plugins was a deliberate guard against accidental one-click deletion of a running plugin (see the related discussion in #5625), and deactivating first lets register_deactivation_hook callbacks run their cleanup (cron events, rewrite rules, transients) before the uninstall routine and the files are removed.
Proposal: keep that safety, drop the friction. Let the Plugins screen delete an active plugin in a single action by deactivating it internally first (firing the normal deactivation hooks), then running the existing uninstall routine, then removing the files. The outcome is identical to today's two clicks, with a confirmation step that covers the accidental-click concern.
Suggested behavior:
- Show Delete for active plugins (currently hidden in both row actions and bulk actions).
- When the target is active, deactivate it first so deactivation hooks fire, then continue down the normal delete and uninstall path.
- Make the confirmation screen state clearly that the plugin is active and will be deactivated before deletion.
This also closes the gap with SFTP and WP-CLI deletes, except it does it the clean way: a raw folder removal skips the hooks entirely and leaves orphaned cron events, options, and tables behind, because WordPress silently drops the missing plugin from active_plugins on the next load.
Reported via: https://x.com/PineDigitalCo/status/2063269549370138686
Change History (3)
#2
@
5 weeks ago
Solid enhancement. Beyond single deletes, bulk actions to delete multiple active plugins at once would be especially useful when cleaning up client installations. The internal deactivation + uninstall approach keeps cleanup intact while dropping the friction.
This ticket was mentioned in PR #12277 on WordPress/wordpress-develop by @sakshamsharma5.
3 weeks ago
#3
- Keywords has-patch added
### Description
This PR is a prototype implementation for the proposal outlined in Trac #65430. It aims to keep the safety of the current safeguard while dropping the UI friction by allowing active plugins to be deleted in a single step.
### Changes
src/wp-admin/includes/class-wp-plugins-list-table.php: Updated to render the "Delete" link and allow bulk deletion selection for active plugins.src/wp-admin/plugins.php: Updated thedelete-selectedaction to intercept active plugins and safely rundeactivate_plugins()prior to the existing uninstall/delete routines.src/wp-admin/includes/ajax-actions.php&src/js/_enqueues/wp/updates.js: Enhanced the AJAX deletion handlers and confirmation prompts to explicitly inform the user when an active plugin is being removed.
Trac ticket: https://core.trac.wordpress.org/ticket/65430
## Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini
Used for: Reviewing the existing implementation and suggesting the changes. Final decisions and edits were made by me.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
As someone who provides website care services, I'm often onboarding clients and having to clean up plugins from years gone by. Being able to simply delete a plugin from the UI is one of those quality-of-life improvements I'd like to see in WordPress.
In my opinion, deleting a single plugin should be as simple as clicking a delete link or, at most, checking the box for the plugin and using the dropdown to delete it. For multiple plugin deletes, we could go straight to the dropdown using bulk actions and choose delete. Behind the scenes, WordPress first deactivates the plugin(s) and then deletes them, giving the plugins the opportunity to clean up after themselves.