StringUtil::plugin_name_from_plugin_file()public staticWC 1.0

Get the name of a plugin in the form 'directory/file.php', as in the keys of the array returned by 'get_plugins'.

Method of the class: StringUtil{}

No Hooks.


String. The name of the plugin in the form 'directory/file.php'.


$result = StringUtil::plugin_name_from_plugin_file( $plugin_file_path ): string;
$plugin_file_path(string) (required)
The path of the main plugin file (can be passed as __FILE__ from the plugin itself).

StringUtil::plugin_name_from_plugin_file() code WC 9.0.1

public static function plugin_name_from_plugin_file( string $plugin_file_path ): string {
	return basename( dirname( $plugin_file_path ) ) . DIRECTORY_SEPARATOR . basename( $plugin_file_path );