W3cubDocs

/WordPress

WP_Plugin_Dependencies::has_unmet_dependencies( string $plugin_file ): bool

Determines whether the plugin has unmet dependencies.

Parameters

$plugin_filestringrequired
The plugin’s filepath, relative to the plugins directory.

Return

bool Whether the plugin has unmet dependencies.

Source

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;
}

Changelog

Version Description
6.5.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_plugin_dependencies/has_unmet_dependencies