WP_Plugin_Dependencies::has_active_dependents( string $plugin_file ): bool

In this article

Determines whether the plugin has active dependents.

Parameters

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

Return

bool Whether the plugin has active dependents.

Source

public static function has_active_dependents( $plugin_file ) {
	require_once ABSPATH . '/wp-admin/includes/plugin.php';

	$dependents = self::get_dependents( self::convert_to_slug( $plugin_file ) );
	foreach ( $dependents as $dependent ) {
		if ( is_plugin_active( $dependent ) ) {
			return true;
		}
	}

	return false;
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.