Drop-Ins and Must-Use WordPress Plugins

What are Drop-ins and Must-use (MU) plugins I hear you shout?  Let’s find out.

Drop Ins

You may not have heard the term or even know they exist but “Drop-ins” allow you to replace some of the core WordPress functionality.

If loaded, they are displayed in the plugins tab section of your WordPress dashboard.

drop-in-plugins

They don’t act like normal plugins though and can’t be activated, deactivated or uninstalled from the dashboard.

They are single PHP files that reside in the /wp-content/ folder and, if they exist, are loaded in automatically by WordPress to replace a particular function such as the message displayed when your site is in Maintenance Mode.

Your /wp-content/ folder may be different from the default.  Check your wp-config.php file to see if the folder is defined in a constant WP_CONTENT_DIR.

There are Drop-ins for single and Multi-Site instances.

If you’re writing one, you don’t have to include the normal PHP plugin header.

[table id=1 /]

Must Use Plugins

We wrote about Must Use plugins in a previous blog so check that out for more detail.

In summary, the Must Use or MU “plugins” reside in the folder /wp-content/mu-plugins/ which you will have to create manually.

They are automatically loaded in by WordPress regardless whether you have installed them or not.

They cannot be activated, deactivated or uninstalled from the dashboard and as long as they reside in the mu-plugins folder then they are active and available – hence the “must use” name 😛

If you want to port an existing plugin over to be a MU one, there are a few caveats.

WordPress looks for a single MU PHP file, so if your plugin has additional files and folders you’ll have to manually include them in your initial PHP file using something like require_once.

As is the same with Drop-ins, the MU plugins do not require a plugin header.

Was this article helpful?
YesNo

1 thought on “Drop-Ins and Must-Use WordPress Plugins”

  1. MU plugin is really important especially if you’re developing a site for clients. I tend to custom file for CPT and place it in the mu-plugins dir so I don’t have to worry if the users accidentally deactivate all plugins or change their theme.

Comments are closed.