Why Use MU Plugins?
Here are a few reasons why you might consider wanting to use MU plugins in WordPress:
To make changes that affect all sites in a multisite installation
While you can use MU plugins in a single WordPress site, this folder is pretty handy especially if you need to make any changes that affect all sites within a multisite installation. An example of this is that you could use a MU plugin to add some custom code to all sites. You can also use it to change the global settings for all sites, like turning off access to some activated plugins so if you have multiple admins, they can’t deactivate or uninstall them.
To avoid conflicts with other plugins
MU plugins are great to use for preventing conflicts with other plugins. For example, in the case you’ve installed a plugin that adds custom code to the theme’s functions.php file, you can use an MU plugin to make sure that custom code loads before another plugin.
MU plugins cleverly help improve the performance of WordPress websites, especially in multisite networks, because they only load once. And yes, they still load once if several sites on that network have it activated.
When might using MU plugins in WordPress not be a good idea?
While there are some advantages to using MU plugins, there are some downsides to consider:
There are no update notifications in the WordPress admin dashboard.
You can’t use activation hooks in the MU plugins folder.
You can only add php files, not entire plugins to the MU plugins folder.
There are no update notifications in the WordPress admin dashboard.
The only update notifications that you receive in the WordPress admin dashboard are for the WordPress core installation, themes, and regular plugins. You don’t receive update notifications for MU plugins. You will have to update that code manually.
You can’t use activation hooks in the MU plugins folder.
Activation hooks basically tell plugins to add or remove specific files for plugins. This cannot be done in the MU plugins folder.
You can only add php files, not entire plugins to the MU plugins folder.
MU plugins are different from the plugins folder (wp-content/plugins) as they are usually single PHP files. They aren’t full folders filled with PHP files, so you might have to create a proxy PHP loader file using a few lines of code like the one below.
<?php // mu-plugins/load.php
require WPMU_PLUGIN_DIR.'/my-plugin/my-plugin.php';
How to Install MU Plugins: 5 Steps
To install an MU plugin, you can use a FTP client. Below is a short step-by-step guide on how to do that. Please note that if you use cPanel through your web host, you can use the File Manager to also manually install a MU plugin in WordPress.
Log in to your web host using a FTP client like Filezilla.
Find the /wp-content/mu-plugins/ directory.
Upload the MU plugin file to the directory.
Once the file is uploaded, the plugin should automatically activate.
Test your website to make sure that the MU plugin is working as expected.
MU Plugins in WordPress Best Practices
Because handling MU plugins means uploading them manually, here’s some best practices to consider using.
Use trusted MU plugins.
Because MU plugins in WordPress are present in every site across a multisite network, using trusted ones is super important. Make sure they are secure so you don’t invite malware across all of the websites on the network.
Keep MU plugins up-to-date.
Like all of WordPress, MU plugins should be kept up-to-date. They can become vulnerable over time and invite malware in. Because you can’t see any updates notices for MU plugins, you will have to plan to update them when the rest of the site needs updates.
Don’t use a lot of MU plugins.
Just like regular plugins, it’s super important to avoid installing a lot of MU plugins. In doing so, you can slow down your multisite installation, which means every site will be sluggish. The MU plugins should only be used if you have common actions that need to be activated across the entire multisite installation.