WP_Plugin_Dependencies::convert_to_slug()
Converts a plugin filepath to a slug.
Method of the class: WP_Plugin_Dependencies{}
No Hooks.
Return
String
. The plugin's slug.
Usage
$result = WP_Plugin_Dependencies::convert_to_slug( $plugin_file );
- $plugin_file(string) (required)
- The plugin's filepath, relative to the plugins directory.
Changelog
Since 6.5.0 | Introduced. |
WP_Plugin_Dependencies::convert_to_slug() WP Plugin Dependencies::convert to slug code WP 6.7.1
protected static function convert_to_slug( $plugin_file ) { if ( 'hello.php' === $plugin_file ) { return 'hello-dolly'; } return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file ); }