Skip to content

How-to Guides

Technical References

VIP Codebase /

/client-mu-plugins directory

In addition to the /mu-plugins directory that loads by default into all VIP environments, there is a dedicated /client-mu-plugins directory in the root of your site git repository. This directory works similarly to WP_CONTENT_DIR . '/mu-plugins/' in a self-hosted WordPress installation.

Plugins added to the /client-mu-plugins directory are installed as MU (“must use”) plugins. We strongly recommend that only custom (and not third-party) plugins are added to the /client-mu-plugins directory, depending on the preferred loading behavior. Specifically, /client-mu-plugins should be used for code that should be auto-loaded or run earlier in the WordPress load process.

Note

Plugins contained within a directory in the /client-mu-plugins directory will need a “loader” file in the root of this directory to require the main plugin file.

Example content of the plugin loader file:

<?php

require WPCOM_VIP_CLIENT_MU_PLUGIN_DIR . '/my-plugin/my-plugin.php';

MU plugins behave differently than plugins installed in the /plugins directory, so be sure to read up on the pros and cons and make a measured choice.

It’s recommended to load third-party plugins from the /plugins directory as many of these plugins utilize the activation / deactivation hooks, both of which are not executed for MU plugins.

Last updated: January 24, 2021