WordPress Plugin Statuses & Types & 2 You Probably Didn't Know About

Posted 16th February 2013 at 05:47 PM by David V
Updated 17th February 2013 at 06:05 PM by David V (Spelling)
Updated 17th February 2013 at 06:05 PM by David V (Spelling)
I'm sure your likely familiar with "Active" plugins, and "Inactive" plugins if you've ever used a plugin in your WordPress website, but did you know there are 2 more types?Thanks,
So, let's just briefly explain each plugin type.
Active - The active plugins are Dah!, the plugins that you have active on your website.
This one is a no-brainer!
Inactive - Again, like the "Active" plugin type, this is the opposite of course.
These plugins are in your "plugins" folder but are "Inactive" or have been "Deactivated".
Must-Use - The "Must-Use" plugins are typically just called "mu-plugins" and they are NOT installed in the "wp-content/plugins/" directory with the rest of your plugins.
The "mu-plugins" are installed into the "wp-content/mu-plugins/" directory.
Now you may ask "Hey, I don't have a folder called "mu-plugins"!
That's no problem, just create one!
Must-Use plugins CANNOT be disabled in the WordPress admin area.
They must be manually removed from the "wp-content/mu-plugins/" directory on your server.
Must-Use plugin are ALWAYS on, therefore the name "Must Use".
These plugins are loaded before your "regular" plugins and are done so in alphabetical order.
Even if they run hooked functions in the global namespace, the API hooks added in a mu-plugin will apply to all other plugins.
The really short answer......Must-Use plugin are ALWAYS on. This may sound good, but let's look at a few downsides.There are ways around this.
- Update notifications and the update status for a mu-plugin will NOT appear on the plugins page.
- Activation hooks are NOT executed by mu-plugins.
- WordPress does not look for any files inside subdirectories in the "wp-content/mu-plugins/" folder so your mu-plugin must be a single PHP file.
Codex Sources:
get_mu_plugins() is located in wp-admin/includes/plugin.php
wp_get_mu_plugins() is located in wp-includes/load.php
Drop-Ins -
I bet you've never heard of these unless your a developer!
You can replace some of the core functionality of WordPress with a "Drop-In" plugin.
They are actually used by some advanced "regular" plugins such as BackupBuddy.
All files need to be placed in the wordpress content directory (wp-content by default, defined in constant WP_CONTENT_DIR).
Drops-Ins do not need to be full plugin files, they can be just standard PHP files.
_get_dropins (Found in "wp-admin/includes/plugin.php")
Returns drop-ins that WordPress uses like so:
What this means is your "Drop-In" plugin file must reside in the "wp-content" directory (as defined in "wp-config") and will be included if they exist.Code:function get_dropins() { $dropins = array(); $plugin_files = array(); $_dropins = _get_dropins(); // These exist in the wp-content directory if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( isset( $_dropins[ $file ] ) ) $plugin_files[] = $file; }
So here's some of the files WordPress loads......
What does all this mean??Code:function _get_dropins() { $dropins = array( 'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ), // WP_CACHE 'db.php' => array( __( 'Custom database class.' ), true ), // auto on load 'db-error.php' => array( __( 'Custom database error message.' ), true ), // auto on error 'install.php' => array( __( 'Custom install script.' ), true ), // auto on install 'maintenance.php' => array( __( 'Custom maintenance message.' ), true ), // auto on maintenance 'object-cache.php' => array( __( 'External object cache.' ), true ), // auto on load ); if ( is_multisite() ) { $dropins['sunrise.php' ] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' ); // SUNRISE $dropins['blog-deleted.php' ] = array( __( 'Custom site deleted message.' ), true ); // auto on deleted blog $dropins['blog-inactive.php' ] = array( __( 'Custom site inactive message.' ), true ); // auto on inactive blog $dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true ); // auto on archived or spammed blog }
Well for example, you could create your own "maintenance.php" and force the site into maintenance mode the same way WordPress does when it updates your site.
Drop-Ins are an advanced topic so if your not a developer I would not recommend messing with this.
If your in the WordPress admin area and on the Plugins page, you'll only see the Drop-ins and Must-Use menus if you have any.
Hope this post was helpful!
David V
Total Comments 0