WP_Plugin_Dependencies::has_unmet_dependencies()public staticWP 6.5.0

Determines whether the plugin has unmet dependencies.

Метод класса: WP_Plugin_Dependencies{}

Хуков нет.

Возвращает

true|false. Whether the plugin has unmet dependencies.

Использование

$result = WP_Plugin_Dependencies::has_unmet_dependencies( $plugin_file );
$plugin_file(строка) (обязательный)
The plugin's filepath, relative to the plugins directory.

Список изменений

С версии 6.5.0 Введена.

Код WP_Plugin_Dependencies::has_unmet_dependencies() WP 6.8

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