Commit 4cb0d2ab08 for wordpress.org
commit 4cb0d2ab08895bc132fb70df060e8fdc97559e41
Author: peterwilsoncc <peterwilsoncc@git.wordpress.org>
Date: Mon Nov 16 01:12:58 2026 +0000
Plugins: Clarify dependency notes on the Plugins screen.
Updates `WP_Plugins_List_Table::add_dependents_to_dependency_plugin_row()` to display a note matching the action blocked by a plugin's dependents:
* Active plugins with active dependents note that the plugin cannot be deactivated until the plugins requiring it are deactivated.
* Inactive plugins note that the plugin cannot be deleted until the plugins requiring it are deleted.
* No note is displayed if neither action is blocked, including for plugins with a circular dependency.
Previously the note stated that the plugin could not be deactivated or deleted until the plugins requiring it were deactivated or deleted, regardless of the plugin's state. This was inaccurate as deactivating the dependents does not allow a plugin to be deleted.
The note is now displayed as an inline warning via `wp_get_admin_notice()`.
The tests are updated to account for the user's capabilities and to cover the notices on the network Plugins screen separately.
Developed in: https://github.com/WordPress/wordpress-develop/pull/12732
Props hbhalodia, joedolson, huzaifaalmesbah, softglaze.
Fixes #64493.
Built from https://develop.svn.wordpress.org/trunk@65531
git-svn-id: http://core.svn.wordpress.org/trunk@64604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php
index 7778f21b46..6aa9c57cd0 100644
--- a/wp-admin/includes/class-wp-plugins-list-table.php
+++ b/wp-admin/includes/class-wp-plugins-list-table.php
@@ -1636,7 +1636,36 @@ class WP_Plugins_List_Table extends WP_List_Table {
return;
}
- $dependency_note = __( 'Note: This plugin cannot be deactivated or deleted until the plugins that require it are deactivated or deleted.' );
+ $dependency_note = '';
+
+ if ( $this->screen->in_admin( 'network' ) ) {
+ $is_network_active = is_plugin_active_for_network( $dependency );
+
+ if ( $is_network_active && current_user_can( 'manage_network_plugins' ) && WP_Plugin_Dependencies::has_active_dependents( $dependency ) ) {
+ $dependency_note = __( 'Note: This plugin cannot be deactivated until the plugins that require it are deactivated.' );
+ } elseif ( ! $is_network_active && ! is_plugin_active( $dependency ) && current_user_can( 'delete_plugins' ) && ! WP_Plugin_Dependencies::has_circular_dependency( $dependency ) ) {
+ $dependency_note = __( 'Note: This plugin cannot be deleted until the plugins that require it are deleted.' );
+ }
+ } else {
+ $is_active = is_plugin_active( $dependency );
+
+ if ( $is_active && ! is_plugin_active_for_network( $dependency ) && current_user_can( 'deactivate_plugin', $dependency ) && WP_Plugin_Dependencies::has_active_dependents( $dependency ) ) {
+ $dependency_note = __( 'Note: This plugin cannot be deactivated until the plugins that require it are deactivated.' );
+ } elseif ( ! $is_active && ! is_multisite() && current_user_can( 'delete_plugins' ) && ! WP_Plugin_Dependencies::has_circular_dependency( $dependency ) ) {
+ $dependency_note = __( 'Note: This plugin cannot be deleted until the plugins that require it are deleted.' );
+ }
+ }
+
+ $dependency_notice = '';
+ if ( '' !== $dependency_note ) {
+ $dependency_notice = wp_get_admin_notice(
+ $dependency_note,
+ array(
+ 'type' => 'warning',
+ 'additional_classes' => array( 'inline' ),
+ )
+ );
+ }
$comma = wp_get_list_item_separator();
$required_by = sprintf(
@@ -1646,9 +1675,9 @@ class WP_Plugins_List_Table extends WP_List_Table {
);
printf(
- '<div class="required-by"><p>%1$s</p><p>%2$s</p></div>',
+ '<div class="required-by"><p>%1$s</p>%2$s</div>',
$required_by,
- $dependency_note
+ $dependency_notice
);
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7e23a2b621..21de7fce5e 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta5-65530';
+$wp_version = '7.2-beta5-65531';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.