The mu-plugins folder

This is an old post. For the most updated information, see this post
What is the mu-plugins folder?

One noticeable difference in the file structure between WordPress and WordPressMU is the addition of the mu-plugins folder. Files placed within this folder will be executed automatically.

If the plugin requires a hook into the plugin activation sequence, it will not be compatible with this auto-execution directory. If this is they case, you will either need to contact the plugin author and recommend a potential fix, or code one up yourself for your own use.

Plugins places in the mu-plugins directory will not show up in the Plugins menu.

Many plugins written to go specifically in this folder do not have an admin panel to show up in the admin area. These plugins usually have code that needs to be added somewhere, and it will mention this either at the top of the plugin’s file or in the plugin’s readme (if it has one). Since this feature is exclusive to MU, regular WordPress plugins placed in this folder may or may not work. If they do not work, it may be a small change needed to the code of the plugin in question. Each case is different and you will either have to read the code of the plugin or ask the plugin author. Please test new plugins one at a time.

Care should be taken as to what plugins are placed here, as and excessive amount will cause your site to slow down or use up resources, as code in this folder is executed on a continuing basis.

(props to lunabyte for clarification)

Comments

  1. Hm… Mu seems to be more difficult than I think. Anyway, thanks to the great resources!

  2. Thanks for the info. I’m fairly new to WPMU, just got a site installed with it, and installed my first Plugin into the MU-Plugins folder, per it’s instructions. Went to activate it and it did not show in the Plugins menu. Thought I had done something wrong. I may still of done it wrong, but it now know that ones placed in the MU-Plugins don’t show.

    Thanks again,
    Tom

  3. Thanks for the info, this clears up a lot, I just started an WordPress MU site and this helps.

  4. For some strange reason I do not have a mu-plugins folder in my wp-content folder. Did I do something wrong with my install?

  5. SS Senthil Kumar says:

    I have been working in WPMU for the past 2 months. I have developed more plugins. But all of them i have placed in “plugin” folder. Just wanted to know plugin vs mu-plugin. Your article cleared me some good questions. Keep posting.. Thanks buddy!

  6. Hi andrea,
    I was searching for difference between “mu-plugins” and sitewide activation.
    Apart from sitewide activation have dashboard interface to manage activation and deactivation, I was trying to find differences that a MU plugin developer should know pertaining to performance, scalability, architecture, forward compatibility.
    I do not have enough data to back up this but I strongly feel that one out of “mu-plugins” and “sitewide activation” method should be deprecated.

    • mu-plugins is for code to execute as soon as the file is placed in there. no activation, runs all the time. Many of the plugins placed in here are ones the admin of the site do not wish the users to control. A good example of this is a custom login screen.

      Sitewide activation is for regular plugins in the regular plugins folder, where they are activated for all blogs. If the user has access to the plugins menu, they can still turn them off. Think of a cotnact form – maybe the admin wants it on for all users, but some of those users may decide they want to deactivate it.

      • Thanks andrea for quick inputs.
        I am thinking about more starting more in-depth discussion on this topic at wpmu forum
        I am doing my homework on this, gathering few points.
        I feel this issue needs more exposure.

  7. any ideas how to change from a hook? so I can run it as mu?

    Here’s what the plugin is using now:

    function runit_activate()
    {
    wp_schedule_event( time(), ‘hourly’, ‘runit_hourly’ );
    update_option( “permalink_structure”, ‘/%postname%/’ );
    update_option( “enable_xmlrpc”, ’1′ );
    update_option( “display_pnp”, ’0′ );
    update_option( “use_pagination”, ’1′ );
    update_option( “wpsc_products_per_page”, ’20′ );
    update_option( “wpsc_page_number_position”, ’3′ );
    }

    // Turn off the hourly event if we deactivate the plugin.
    function runit_deactivate()
    {
    wp_clear_scheduled_hook( ‘runit_hourly’ );
    }
    register_activation_hook(__FILE__, ‘runit_activate’);
    register_deactivation_hook(__FILE__, ‘runit_deactivate’);

  8. I’m setting up new wpmu for my own. This is good information for me. thank you

  9. Hi pals,
    I successFully install WordPress MU in my localhost system. Friends,I need to give Each Blog to Different Theme. If I have 10 blogs there,
    I need to give 10 different themes for same. Is that Possible in WordPress MU … Please Give A solution as Early as Possible….

    You can contact me : anes.pa@amskape.com also…

    With Great Regards
    Anes P.A

    • hi there

      yes you add as many themes as you want in to the wpmu themes folder and each blog you create can have a different themes selected.

      after all that is the basic idea behind the MU system. :)

  10. Let me summarise what I think is being said here. The plug-ins that work across all MU blogs are called MU plugins and these plugins are optionless? I understand the options can be set in PHP but what about plugins like Contact Form 7 and Gravity Forms where you build stuff using the UI? And no one here has even mentioned that! If I’m wrong then MU (now part of 3.0) just might be worth a try. If I’m not, MU has taken away the very thing that makes WP great.

    • “these plugins are optionless”

      Not necessarily. They are must-use and are always active. If they have an admin screen you still have access to the admin screen.

    • “The plug-ins that work across all MU blogs are called MU plugins and these plugins are optionless? ”

      No. Some of them have options pages. The only plugins that go in this folder will specifically instruct you to do so in their readme.txt file.

      do NOT put regular plugins here.

      If you;re using things like contact forms, you activate them as usual or Network-wide. Each options page will still need to be filled in from the backend of each blog.

  11. //FYI for anyone who wants to know the answer to my question from last year, I changed it to be
    function runit_activate()
    {
    $installed = get_option( ‘my_software_setup’ );
    // make this unique as you do not want this to collide with anyone else’s options
    if (!$installed ==’001′) {

    wp_schedule_event( time(), ‘hourly’, ‘runit_hourly’ );
    update_option( ‘permalink_structure’, ‘ / % postname % / ‘ );
    update_option( ‘enable_xmlrpc’, ’1′ );
    update_option( ‘display_pnp’, ’0′ );
    update_option( ‘use_pagination’, ’1′ );
    update_option( ‘wpsc_products_per_page’, ’20′ );
    update_option( ‘wpsc_page_number_position’, ’3′ );
    add_option(“my_software_setup”, ’001′, ”, ‘no’);
    }
    }

    // Turn off the hourly event if we deactivate the plugin.
    function runit_deactivate()
    {
    wp_clear_scheduled_hook( ‘runit_hourly’ );
    delete_option(‘my_software_setup’);
    }
    // You can leave this if you want an option to use it in the plugins folder also
    register_deactivation_hook( __file__, ‘runit_deactivate’ );

  12. i have installed mu plugin and i create a plugin where i want every blog user insert a tag line there blog admin can also insert a tag line but admin tag line should be shown on every plugin how can i do this thing in mu plugin please tell me as soon as possible

Trackbacks

  1. [...] on the WPMU plugin kick: MU’s “mu-plugins” folder is great for plugin functionality which should be available for all MU sites without [...]