WP_Plugin_Dependencies::get_dependent_names()public staticWP 6.5.0

Gets the names of plugins that require the plugin.

Method of the class: WP_Plugin_Dependencies{}

No Hooks.

Return

Array. An array of dependent names.

Usage

$result = WP_Plugin_Dependencies::get_dependent_names( $plugin_file );
$plugin_file(string) (required)
The plugin's filepath, relative to the plugins directory.

Changelog

Since 6.5.0 Introduced.

WP_Plugin_Dependencies::get_dependent_names() code WP 6.7.1

public static function get_dependent_names( $plugin_file ) {
	$dependent_names = array();
	$plugins         = self::get_plugins();
	$slug            = self::convert_to_slug( $plugin_file );

	foreach ( self::get_dependents( $slug ) as $dependent ) {
		$dependent_names[ $dependent ] = $plugins[ $dependent ]['Name'];
	}
	sort( $dependent_names );

	return $dependent_names;
}