WordPress MU Plugins

WordPress have huge list of plugins and features. Its time to learn about a new feature of wordpress. A WordPress MU Plugin (also known as must use plugin) are plugins installed in a special directory inside the content folder and which are automatically enabled on all sites in the installation.

These plugins will always be activated by default. You don’t need to do activate by yourself. To Activate plugin by default you just need to put in the right directory. WordPress will automatically know that this plugin under mu-plugins directory must be used.


A mu-plugin or Must Use Plugin can not be De-activated.


Must Use PLugin Directory


If you never used mu-plugins before , this directory will not be exist in wp-content directory. But you can create this directory without having any problem.


If you want to change your mu-plugins directory, you can change it by defining two constant WPMU_PLUGIN_DIR  and WPMU_PLUGIN_URL  in the wp-config.php file.  

define(‘WPMU_PLUGIN_DIR’ , ‘full path new directory’);
define(‘WPMU_PLUGIN_URL’ , ‘full url new directory’);

But you should be very careful if defined directory path and url not valid, mu-plugins would not be loaded. You should define the constants like as given in above image. 


If you are very sure and confident only then you need to change the directory path and url of mu-plugins otherwise you should not need to define these constant and remain as default values of these two constants. Because it will safer and will be more practical. 


Its time to create first Must Use Plugin

Step – 1 Create a folder with name of mu-plugins under your wp-content directory.


Step – 2 Create a file with name of my-first-mu-plugin.php (Name can be whatever you want) inside the mu-plugins directory.


Step – 3 Add below code in your created file.


function displayMyFirstMUPlugin() {
    echo ‘<p style=”position: absolute; top: 100px; right: 10; padding: 10px; 
    background-color: #5596FF; color: #FFFFFF;”>Hey Wow This Is My First MU Plugin!</p>’;


Step – 4 Now if everything is fine go to the your wordpress website and see your mu-plugin in action. See below image how will look like .



Wow i am so excited to see my first mu-plugin in action. Great Job!


Step – 5 Now i want to look my mu-plugin in the admin area. Go to your installed plugins directory in admin area. There is a option you will see like “Must Use (1)” . Like below image.




Step – 6 To see the full list of created mu-plugin click on Must-Use Tab. In our case i have only one mu-plugin. See below image for listing of MU-Plugins.





So finally we have seen our first mu-plugin in action. We saw in admin are this plugin dont have any option to deactivate plugin. This plugin will automatically load. 


For more official information on MU-Plugin (Must Use Plugin) you can go through below link.


MU-Plugin (Must Use Plugin)



Leave a Reply

Your email address will not be published. Required fields are marked *