Skip to content

Backgrounds

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 Platform environments, a dedicated /client-mu-plugins directory is available in the root of a site’s code 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.

VIP strongly recommends 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.

MU plugins behave differently than plugins installed in the /plugins directory, and the pros and cons of each method should be reviewed and evaluated.

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

Plugin loader file

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';

Last updated: December 09, 2021