WP_Plugin_Dependencies::has_unmet_dependencies
Determines whether the plugin has unmet dependencies.
Method of the class: WP_Plugin_Dependencies{}
No Hooks.
Returns
true|false. Whether the plugin has unmet dependencies.
Usage
$result = WP_Plugin_Dependencies::has_unmet_dependencies( $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_unmet_dependencies() WP Plugin Dependencies::has unmet dependencies code WP 6.9.1
public static function has_unmet_dependencies( $plugin_file ) {
if ( ! isset( self::$dependencies[ $plugin_file ] ) ) {
return false;
}
require_once ABSPATH . 'wp-admin/includes/plugin.php';
foreach ( self::$dependencies[ $plugin_file ] as $dependency ) {
$dependency_filepath = self::get_dependency_filepath( $dependency );
if ( false === $dependency_filepath || is_plugin_inactive( $dependency_filepath ) ) {
return true;
}
}
return false;
}