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?
- Do lowercase and uppercase characters matter?
- 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?
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__ );