WP_Plugin_Dependencies::convert_to_slug( string $plugin_file ): string

In this article

Converts a plugin filepath to a slug.

Parameters

$plugin_filestringrequired
The plugin’s filepath, relative to the plugins directory.

Return

string The plugin’s slug.

Source

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 );
}

Changelog

VersionDescription
6.5.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.