Opened 9 months ago
Last modified 8 days ago
#64493 accepted defect (bug)
Plugin dependencies: better messaging or management of plugin active states
| Reported by: | joedolson | Owned by: | joedolson |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Plugins | Version: | 6.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | administration, ui-copy |
Description
Currently, if a plugin cannot be deleted due to plugin dependencies, it has a single message that shows "Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted."
The message is inaccurate in two ways - you cannot delete a plugin unless the plugins that require it are deleted; deactivating is not sufficient; and it does not reflect the current state of the plugin. If the plugin with dependents is already deactivated, it still states that it cannot be deactivated.
Much of the structure of plugin dependencies seems to ignore whether a referenced plugin is active or not.
The checks are dependent on get_dependent_names(), which does not contain any reference to whether or not a plugin is active.
At minimum, the messages should be improved so that they accurately reflect what needs to happen; alternately, the messages and states should be matched so that the possible scenarios are reflected more accurately.
Attachments (2)
Change History (13)
#3
@
9 months ago
- Keywords has-patch added
The dependency note shown in the Plugins list table currently states that both
deactivation and deletion are blocked, which is misleading.
This patch updates add_dependents_to_dependency_plugin_row() to distinguish
between:
- blocking deactivation when dependent plugins are active, and
- blocking deletion when dependents exist but are inactive.
The change reuses WP_Plugin_Dependencies::has_active_dependents() and is
messaging-only.
Patch attached.
#6
@
5 months ago
"This plugin enhances the functionality of [main plugin]. It may not be de-activated until the parent plugin is also de-activated."
#7
@
3 months ago
- Milestone 7.1 → 7.2
This doesn't have a patch started yet, and since we're nearing the end of beta, I think it's best to bump this to 7.2.
This ticket was mentioned in PR #12732 on WordPress/wordpress-develop by @hbhalodia.
3 months ago
#8
Trac ticket: https://core.trac.wordpress.org/ticket/64493
## Use of AI Tools
- Claude Code, Opus 5
- Used on inital implementation and drafting the message and PR description. Final implementation reviwed by me and tested in local env.
---
## AI Summary
The "Required by" note on the Plugins screen uses a single static message that doesn't match reality. This change generates it from the plugin's current state so it reflects the action that's actually available.
## Problem
For any plugin with dependents, the note always reads:
Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.
This is wrong in two ways:
- Deletion — a dependent must be *deleted*; deactivating it is not sufficient. So "deactivated or deleted" is inaccurate.
- State — the message never changes. It claims a plugin "cannot be deactivated" even when it has no active dependents (deactivation is actually allowed), or when the plugin is already inactive. It also mentions deletion for active plugins, which can't be deleted anyway (Delete is only offered for inactive plugins).
## Fix
The note in WP_Plugins_List_Table::add_dependents_to_dependency_plugin_row() now branches on the plugin's active state, using the same signals that gate the action links (is_plugin_active() / has_active_dependents()):
- Active plugin, with an active dependent →
Note: This plugin cannot be deactivated until the plugins that require it are deactivated. - Active plugin, no active dependents → no note (deactivation is allowed).
- Inactive plugin →
Note: This plugin cannot be deleted until the plugins that require it are deleted.
The message is also now rendered as an inline admin notice via wp_get_admin_notice() (type => 'error', additional_classes => array( 'inline' )) instead of a plain paragraph, so it's styled consistently with other admin notices.
When there is no applicable restriction, no notice is output.
## Example
Plugin "Example Dependency" is required by "Example Dependent One":
| Scenario | Old note | New note |
|---|---|---|
| Both active | cannot be deactivated or deleted until … deactivated or deleted | cannot be deactivated until … deactivated |
| Dependency active, dependent inactive | _(same wrong message)_ | _(no note — deactivation is allowed)_ |
| Dependency inactive | _(same wrong message)_ | cannot be deleted until … deleted |
#9
@
3 months ago
Hi Team, Have raised the PR with the fix, which now correctly shows the message and differentiate it correctly.
Thanks,
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Related, but not the same: #64475