If you’re ever tinkering around and looking at the file structure of your WordPress site, you might come across MU plugins in WordPress. Not all WordPress websites have this be default. So, what are MU plugins? Is it different from the other plugins in WordPress? In this article, you’ll learn all about MU plugins, why you might want to use them, and even how to install them.
What is a MU Plugin?
A MU plugin, also known as a must-use plugin, is a plugin that is installed in the /wp-content/mu-plugins/ directory of WordPress. Typically MU plugins, if they are present, are activated and cannot be deactivated, unless you manually remove them. Usually they are used to perform specific actions or add features on all sites in a multisite installation, like adding custom code or changing global settings of WordPress.
MU plugins in WordPress can be used in single site installations. These are typically done with web hosts that require sites to have features that work well with their setup, like caching and security. For example, some web hosts add the Limited Login Attempts to the MU Plugins folder and do not allow users to manually remove the plugin from their WordPress installation. The Limit Login plugin helps with stopping bot attacks from gaining access to the WordPress admin or overwhelming the site from tons of login attempts (also known as a brute force attack.)
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.
- To avoid conflicts with other plugins.
- To improve performance.
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.
To improve performance
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.
- Keep MU plugins up-to-date.
- Don’t use a lot of MU plugins.
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.
In Summary
MU plugins in WordPress can be a cleverly powerful tool to not just manage many sites within a multisite network because it can efficiently help with performance. If you install MU plugins, make sure to use best practices within this article to keep your WordPress sites running smoothly.
Frequently Asked Questions
Is WordPress free?
All you need to do to use WordPress is to invest in a web hosting plan since the software itself is free.
Are WordPress plugins free?
WordPress has loads of plugins you can install, some of them are free, but some of them you will need to pay for. You can learn how to use WordPress Plugins on our blog.
Why choose Verpex for WordPress?
As the leading CMS out there, we’ve made it our mission to offer the most comprehensive and streamlined WordPress solutions on the market. Backed by a responsive customer care team and reliable site enhancement tools, we ensure our users get the full WordPress value and support for a reasonable price.
Who should use hosting for WordPress?
First of all - people using CMS WordPress
Nile Flores is a long time professional blogger, as well as WordPress website designer and developer from the St. Louis Metro East. Nile blogs at NileFlores.com, where she’s passionate about helping website owners, whether they’re small business owners or bloggers. She teaches about Blogging, Social Media, Search Engine Optimization, Website Design, and WordPress. Additionally, Nile loves to speak at WordCamps (WordPress conferences) across the United States. When Nile isn’t knee-deep in coding, she’s a proud mom of a college student, and enjoys oil painting, cigar smoking, nail art design, and practicing traditional Okinawan kempo karate.
View all posts by Nile Flores