Beginner’s Guide to WordPress Must-Use & Drop Ins plugins

Sometimes, you will facing the Must-Use or Drop Ins section when navigate to the WordPress Plugins list page. You can’t touch it except uninstall it by removing the plugin file from the must-use or wp-content directories, which is found in wp-content/mu-plugins by default.
Popular plugins that do belong in this folder are ones like Domain Mapping and W3 Total Cache.
Must-use plugins allow users to add features which are not present by default in the WordPress core but that are needed for users.

What’s about WordPress Must-Use Plugins

The mu-plugins directory was originally implemented by WPMU (Multi-User) to offer site admins an easy way to activate plugins by default on all blogs in the farm.
Must-use plugins (a.k.a. mu-plugins) are plugins that will always be activated by default, without you needing to do it yourself. Must User plugins are designed to have loading priority over regular plugins, it will always be executed, unless it is uninstalled.

  • Always-on, no need to enable via admin and users cannot disable by accident.
  • Can be enabled simply by uploading file to the mu-plugins directory, without having to log-in.
  • Must-use plugins allow users to add features which are not present by default in the WordPress core but that are needed for users.
  • Loaded by PHP, in alphabetical order, before normal plugins, meaning API hooks added in an mu-plugin apply to all other plugins even if they run hooked-functions in the global namespace.
  • You loose the settings when change themes or plugins. By using a “Must Use” plugin, the code will always be available – no matter what network, theme, or curious guest blogger might do otherwise. It’s very useful in WordPress Multisite (Network)

Beginner's Guide to WordPress Must-Use plugins
Beginner’s Guide to WordPress Must-Use plugins

How do I create a “Must Use” Plugin?

Must-use plugin is not too different to a classic plugin, but there are some things to know.

  • Your plugin must place in /wp-content/mu-plugins/ folder.
  • WordPress only looks for PHP files right inside the mu-plugins directory, and (unlike for normal plugins) not for files in subdirectories. You may want to create a proxy PHP loader file inside the mu-plugins directory:
    
    

    This is necessary because if you store this loader in a subdirectory, it won’t be executed by WordPress and the other plugins won’t be either.

  • Plugins in the must-use directory will not appear in the update notifications nor show their update status on the plugins page, so you are responsible for learning about and performing updates on your own.

Drop Ins

Like Must-Use plugins, if Drop Ins plugins loaded, they are displayed in the plugins tab section of your WordPress dashboard.

WordPress Drop Ins plugins
WordPress Drop Ins plugins

And they can’t be activated, deactivated or uninstalled from the dashboard too.

Drop-ins are advanced plugins in the wp-content directory that replace WordPress functionality when present.

Don't like Must-Use plugins, they are single PHP files that reside in the /wp-content/ folder and WordPress auto dectect

List of all WordPress Drop-Ins

File Type of Plugin Loaded Context
advanced-cache.php Advanced caching plugin. on WP_CACHE value Single
db.php Custom database class always Single
db-error.php Custom database error message on error Single
install.php Custom install script on install Single
maintenance.php Custom maintenance message on maintenance Single
object-cache.php External object cache always Single
sunrise.php ‘Executed before Multisite is loaded on SUNRISE value Multi
blog-deleted.php Custom blog deleted message on deleted blog Multi
blog-inactive.php Custom blog inactive message on inactive blog Multi
blog-suspended.php Custom blog suspended message on archived or spammed blog Multi

How to get list of Drop Ins plugins

If you want to get a list of all the available DropIns create a small Plugin which contains the following code.

Conclusion

There is another disadvantage of must-use and drop ins plugins which we did not cover above.

  • WordPress won’t tell you if an update exists for mu-plugins, so if you use one that you did not write yourself, you will have to verify by yourself if an update exists.
  • If the core WordPress function is available to be altered by a Drop Ins (not every file has this capability), it will be replaced by they custom file, and is now called a Drop Ins plugins.
    Drop Ins are not harmful by nature, for example if you have W3 Total Cache installed

2 thoughts on “Beginner’s Guide to WordPress Must-Use & Drop Ins plugins”

Comments are closed.