diff --git a/README.md b/README.md index 9ee8567..0a5a69f 100644 --- a/README.md +++ b/README.md @@ -114,3 +114,13 @@ If you work on Windows but use a Linux VM to run your development server, you ma "force-unix-separator": true } ``` + +## Modifying the src directory of the mu plugins + +You may wish to change the src directory you want the mu plugins to be loaded from. For example, on WordPress VIP projects +you may wish to load mu plugins from client-mu-plugins using this loader. To do this you can set a constant to tell the +mu plugin loader where your mu plugins are kept: + +```php +define('MU_PLUGIN_LOADER_SRC_DIR', WPCOM_VIP_CLIENT_MU_PLUGIN_DIR . '/'); +``` diff --git a/src/lkwdwrd/mu-loader.php b/src/lkwdwrd/mu-loader.php index 1e4719d..3bb506b 100644 --- a/src/lkwdwrd/mu-loader.php +++ b/src/lkwdwrd/mu-loader.php @@ -31,7 +31,7 @@ */ if (! defined('WP_INSTALLING') || ! WP_INSTALLING ) { // Run the loader unless installing - Loader\mu_loader(); + Loader\mu_loader(false, Loader\PS, defined('MU_PLUGIN_LOADER_SRC_DIR') ? MU_PLUGIN_LOADER_SRC_DIR : Loader\MUDIR); } /** diff --git a/src/lkwdwrd/util/loader.php b/src/lkwdwrd/util/loader.php index 7276ecb..0a0632e 100644 --- a/src/lkwdwrd/util/loader.php +++ b/src/lkwdwrd/util/loader.php @@ -33,7 +33,7 @@ */ function mu_loader( $plugins = false, $ps = PS, $mudir = MUDIR ): void { if ( ! $plugins ) { - $plugins = get_muplugins(); + $plugins = get_muplugins(ABSPATH, WP_PLUGIN_DIR, $mudir); } foreach( $plugins as $plugin ) { // Conditionally register the MU plugin in WordPress 3.9 or newer.