Automattic\WooCommerce\Utilities
StringUtil::plugin_name_from_plugin_file()
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.
Return
String
. The name of the plugin in the form 'directory/file.php'.
Usage
$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() StringUtil::plugin name from plugin file code WC 8.7.0
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 ); }