WP_Plugin_Dependencies::has_circular_dependency()public staticWP 6.5.0

Determines whether the plugin has a circular dependency.

Method of the class: WP_Plugin_Dependencies{}

No Hooks.

Return

true|false. Whether the plugin has a circular dependency.

Usage

$result = WP_Plugin_Dependencies::has_circular_dependency( $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_circular_dependency() code WP 6.5.3

public static function has_circular_dependency( $plugin_file ) {
	if ( ! is_array( self::$circular_dependencies_slugs ) ) {
		self::get_circular_dependencies();
	}

	if ( ! empty( self::$circular_dependencies_slugs ) ) {
		$slug = self::convert_to_slug( $plugin_file );

		if ( in_array( $slug, self::$circular_dependencies_slugs, true ) ) {
			return true;
		}
	}

	return false;
}