Reusing Plugin Slugs

Have you ever noticed that plugins folder names never change? For example Yoast SEO is under a folder called wordpress-seo while Google Analytics for WordPress by MonsterInsights is within google-analytics-for-wordpress. While plugin names can change the folder names are unchangeable.

These persistent folders, also called plugin slugs, are used in two places. First on at, and within your local WordPress installation at /wp-content/plugins/wordpress-seo/. This is what WordPress uses internally to autoupdate the correct plugin.

Extracting plugin slugs with javascript

While on the plugin screen you extract a full list of plugin slugs using a few lines of javascript within Google Chrome console.

Screen Shot 2017-04-06 at 8.32.38 PM.png
plugins = [];
jQuery('#the-list').each(function() {
   plugin = jQuery(this).data('plugin');
   folder = plugin.split("/");
   folder = folder[0];
plugins.join(" ");

Having a single list of plugin slugs can be used with wp-cli to quickly reinstall on another installation. While this will only work for any free plugins on, I still find this useful and saves some time uploading plugins over FTP.

Screen Shot 2017-04-06 at 8.33.08 PM.png