How can I find plugins’ slug?

I’m wondering how can I find plugins’ slug (slug = internal name used by WordPress to do plugin updates and to determine which plugins are currently active)? It is usually plugin’s folder name but if a plugin doesn’t have a folder, it is its file name (like hello.php). Are there any other exceptions?

  1. Do lowercase and uppercase characters matter?
  2. Can a plugin have different slug than its folder name? What if there’s a plugin called hello.php and another /hello.php/hello.php?

8

The string used in WordPress to identify the plugin is:

plugin_basename($file);

… where $file is a file with the plugin headers.

So if you are in your plugin, get the slug with:

$slug = plugin_basename( __FILE__ );

Leave a Comment