W3cubDocs

/WordPress

WP_Plugin_Dependencies::has_circular_dependency( string $plugin_file ): bool

Determines whether the plugin has a circular dependency.

Parameters

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

Return

bool Whether the plugin has a circular dependency.

Source

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

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_circular_dependency