WP_Plugin_Dependencies::convert_to_slug
Converts a plugin filepath to a slug.
Метод класса: WP_Plugin_Dependencies{}
Хуков нет.
Возвращает
Строку. The plugin's slug.
Использование
$result = WP_Plugin_Dependencies::convert_to_slug( $plugin_file );
- $plugin_file(строка) (обязательный)
- The plugin's filepath, relative to the plugins directory.
Список изменений
| С версии 6.5.0 | Введена. |
Код WP_Plugin_Dependencies::convert_to_slug() WP Plugin Dependencies::convert to slug WP 7.0
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 );
}