wp-content/mu-plugins and wp-content/plugins: using them correctly

Hi,

Sorry to post about this but I need a confirmation.

As far as I understand, all plugins placed into the wp-content/mu-plugins folder are executed automatically and sometimes on every page load (!).... That means that putting all the plugins into this folder could be very resource intensive and dramatically slow down the entire website. Correct?

I'm asking this because I've seen several installation instructions stating that the plugin could be placed either in the mu-plugins folder or in the plugins folder, without any warning.

Example: https://premium.wpmudev.org/project/subscribe-by-email/installation/

If you want Subscribe by email to be activated automatically site-wide for all blogs upload subscribe-by-email.php into wp-content/mu-plugins/

I think this is not a good reason to put this plugin into the mu-plugins folder. This plugin should be put into the normal plugins folder and activated sidewide by the super admin (network activate), shouldn't it? What would happen if someone put all your 100+ plugins into the wp-content/mu-plugins/?

Well, I think it would be helpfull to know exactly what are the rare (?) WPMUDEV plugins that must be placed into this particular folder.

  • Aaron

    It's actually less resource intensive than activating a plugin technically (but negligibly) as it doesn't require a db call.

    But to the main question, follow the install instructions because it's about where the plugin is designed to work from or what you want the plugin to do rather than efficiency.

    That being said, we are gradually rewriting most if our plugins to work network activated primarily (that's a fairly recent addition to WPMU).

  • Lorange

    Hello Aaron,

    Thank you for your reply!

    It's actually less resource intensive than activating a plugin technically (but negligibly) as it doesn't require a db call.

    Is that really true?

    Please let me cite the wpmututorials.com blog (writing about the mu-plugins folder):

    Obvious conclusions were drawn because of the name and where it was, but this actually stands for “must-use” plugins. Why? Because any code (plugin) placed in the folder is run automagically, as if it were part of WordPress itself.

    (...)

    While you may be tempted to toss all your plugins in there – don’t. Like stated above, the code placed in here runs automatically and (depending on how the plugin is coded) on every single page load.

    So I just wanted to be sure that when your installation instructions (that are sometimes a little vague) ask to put the plugin into the mu-plugins folder, that is for a good reason. The subscribe-by-email plugin is a typical example of plugin I would have placed into the normal plugins folder. But your installation instructions ask to place it into the mu-plugins folder. I have the same doubt with your Forums plugin. The installation instructions ask to put it into the mu-plugins folder. Is that really necessary? Wouldn't it better to place it into the normal plugins folder and activate it sidedwide?

    Sorry if I'm annoying you with these questions, but I want to be sure to make the right choices in order to prevent unnecessary and superfluous consumption of resources in the future.

    Laurent

  • Mason

    Hiya Laurent,

    As Aaron said, we're in the process of making many of our plugins work from the regular plugins directory. You can install the Subscribe by Email plugin (as you mentioned) in the plugins dir.

    It does also depend on what the plugin is meant to do as to whether it can work from one directory or another. You'll see some changes to the installation instructions on this site over the next few weeks and some updates to the plugins to match.

    Thanks!

  • Aaron

    Is that really true?

    Yes it is. Any activated plugin gets included on every page load of WP. A network activated plugin gets included on every pageload of every site in the network, exactly the same as mu-plugins. The difference though is before a network activated plugin can be included the list of which ones to load has to be pulled from the db, hence they're actually a tad bit slower, but not much.

    Also mu-plugins get included very early before any other, so it's necessary for some advanced plugins like domain mapping.

    Technical issues aside though, it is imperitve to install where the instructions say, as the code in the plugins is designed for that and can cause errors otherwise.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.