WP_Plugin_Dependencies::has_active_dependents
Determines whether the plugin has active dependents.
Method of the class: WP_Plugin_Dependencies{}
No Hooks.
Returns
true|false. Whether the plugin has active dependents.
Usage
$result = WP_Plugin_Dependencies::has_active_dependents( $plugin_file );
- $plugin_file(string) (required)
- The plugin's filepath, relative to the plugins directory.
Changelog
| Since 6.5.0 | Introduced. |
WP_Plugin_Dependencies::has_active_dependents() WP Plugin Dependencies::has active dependents code WP 6.9.1
public static function has_active_dependents( $plugin_file ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$dependents = self::get_dependents( self::convert_to_slug( $plugin_file ) );
foreach ( $dependents as $dependent ) {
if ( is_plugin_active( $dependent ) ) {
return true;
}
}
return false;
}