What is mu-plugins, do I need to install that?

Dear Support, do I need to install mu-plugins for the domain mapping to work? I already installed the domain mapping plugin, but haven't configure it yet.

I have read the following 2 posts at your site.



I couldn't find the "mu-plugins" plugin.

Thank you,

Imad Daou

  • Ash

    Hello @Imad

    Welcome to WPMU community Happy New Year!!

    I hope you are well today and thanks for asking the question.

    mu-plugins is not a plugin, it's just another folder like plugins.

    To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste any code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always.

    The concept is, suppose you need to add a hook, so normally we add it into theme's functions.php. But theme is changeable and we can change the theme and we may forget to re-include that hook. Other situation is, if you have a multisite, different subsites will use different themes, so it's not possible to put that code into hundreds of themes. In that case, we use mu-plugins, to force all sites to use that code snippet.

    About domain mapping plugin, I don't think now you need to use mu-plugins at all. Please follow the usage here: https://premium.wpmudev.org/project/domain-mapping/#usage

    Please let me know if you find this is helpful, or if you have any further questions.


  • Imad

    That's great Ash, I didn't find the mu-plugin folder and I have created one as you suggested, but haven't uploaded any file with a code since I don't know really what to upload. Is it fine to have it set their as empty folder? Where and at which stage Wordpress would need such folder? I know that you mentioned something about Theme updates, is there any other usage for this folder other than themes updates?

    By the way, what is the difference between the theme updates you mentioned using mu-plugin folder and the Child theme? is this a better solution than having a child theme for each parent theme? if it is, how would I take advantage of that and not use a child theme?

    Thank you,

    Imad Daou

  • Ash

    Hi there

    Why did you create mu-plugins folder if you don't need it? :slight_smile: Well, having an empty folder is not a problem, don't worry with that.

    Suppose, you have 3 themes, A, B and C
    And you have 3 plugins X, Y and Z

    A theme is activated now, so NOT A SINGLE CODE will be executed from B and C theme.
    Similarly, if you have activated X and Z plugin, NOT A SINGLE CODE will be executed from Y plugin.

    But if you use mu-plugins, these code will always be executed. It doesn't mater which themes/plugins are activated or not. Even you won't be able to deactivate the mu-plugins from dashboard, to deactivate you must delete the files from mu-plugins folder. Here, MU means Must Use. So, these codes must be executed.

    Suppose, you have a multisite and you want some script to be executed in all subsites, then you can use mu-plugins so that blog admins can't deactivate that script :slight_smile:

    is this a better solution than having a child theme for each parent theme

    There is no relation between child theme and mu-plugins. Let me make you clear about this.

    Suppose, you are using a good theme - A and the developer is too serious and he releases updates in a certain interval. Now, you may need to make some changes in the theme. If you do so, be sure your changes will be lost when you will update the theme. There are two solutions - 1. Note down changes and make changes each time you update the theme, 2. Create a child theme and push your changes in there and rest :slight_smile:

    Using child theme is highly recommended. What I was trying t say in my first reply is, if you don't use a child theme and don't want to lose your changes, you may use mu-plugins. but be sure, mu-plugins is not an ALTERNATE of child theme :slight_smile:

    Note that, I used blocked caps letter just to make your attention in those words, I didn't mean anything, please don't take it otherwise :slight_smile:

    Please let me know if you find this is helpful, or if you have any further questions.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.