WordPress Must-Use Plugins

"My words fly up, my thoughts remain belo...
Image by ZedZap via Flickr

WordPress has quite a few hidden features.  My favourite so far: MU Plugins, or “must-use plugins”.  Introduced with WP 3.0, the code says:

 * Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data.
 * WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).
 * @since 3.0.0
 * @return array Key is the mu-plugin file path and the value is an array of the mu-plugin data.

Basically, this means: anything you put in wp-content/mu-plugins/ will get automatically included in WordPress. But it has to be a .php file directly within the mu-plugins directory, like: wp-content/mu-plugins/myplugin.php. Folders don’t work, unless you include a .php folder that loads in files from a subdirectory.

This is pretty huge.  For example, I use it to load up a small library of sub-plugins and global settings for all our WordPress sites.

Example: we have a plugin with an ad widget that we use across our network of blogs.  I can just drop my ad widget plugin into mu-plugins/ and never have to worry about someone accidentally de-activating it.

1 thought on “WordPress Must-Use Plugins

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s