WP_Plugin_Dependencies::has_unmet_dependencies()public staticWP 6.5.0

Determines whether the plugin has unmet dependencies.

Method of the class: WP_Plugin_Dependencies{}

No Hooks.

Return

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() code WP 6.7.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;
}