PHPackages                             boxuk/wp-muplugin-loader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. boxuk/wp-muplugin-loader

Abandoned → [roots/bedrock-autoloader](/?search=roots%2Fbedrock-autoloader)ArchivedComposer-plugin[Utility &amp; Helpers](/categories/utility)

boxuk/wp-muplugin-loader
========================

A drop-in MU Plugin loader for WordPress

2.2.0(2y ago)21422.7k↑20.8%6[1 issues](https://github.com/boxuk/wp-muplugin-loader/issues)9MITPHPPHP ^7.4 || ^8.0 || ^8.1 || ^8.2

Since Oct 5Pushed 1y ago2 watchersCompare

[ Source](https://github.com/boxuk/wp-muplugin-loader)[ Packagist](https://packagist.org/packages/boxuk/wp-muplugin-loader)[ RSS](/packages/boxuk-wp-muplugin-loader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (32)Used By (9)

WP Must-Use Plugin Loader
=========================

[](#wp-must-use-plugin-loader)

> This project is now abandoned. We've moved to use [Roots Bedrock Autoloader](https://github.com/roots/bedrock-autoloader) in our [project skeleton](https://github.com/boxuk/wp-project-skeleton).

Attribution
-----------

[](#attribution)

- This package was forked from [WP Must-Use Plugin Loader](https://github.com/lkwdwrd/wp-muplugin-loader)due to it seemingly falling into abandonment. We are happy to contribute our work back to the source should the maintainer pick up the project again.

Overview
--------

[](#overview)

Managing plugins using the [Composer Installers](https://github.com/composer/installers) library works remarkably well. However, its handling of MU plugins leaves something to be desired.

WordPress MU (must use) Plugins are files that are placed in the `wp-content/mu-plugins/` folder. These files are loaded automatically. The problem is when a plugin is actually inside a folder. WordPress will only load .php files and doesn't drop into any directories. When the Composer Installers plugin runs, it always puts the repo into a nice contained folder. This means the Composer Installers MU plugins never actually run!

There are manual ways around this that work fine, but I want to get away from any manual steps when running the install. No extra files, just run `composer install` or `composer update` and have it work. That is what the WP Must-Use Plugin Loader does.

Usage Instructions
------------------

[](#usage-instructions)

In your project's `composer.json` file, require this package.

```
"require": {
	"composer/installers": "~1.2.0",
	"johnpbloch/wordpress": "*",
	"boxuk/wp-muplugin-loader": "~1.0",
}
```

Make sure in the `extras` of your `composer.json` you have your mu-plugins path defined.

```
"extra": {
	"installer-paths": {
		"app/wp-content/themes/{$name}": [
			"type:wordpress-theme"
		],
		"app/wp-content/plugins/{$name}": [
			"type:wordpress-plugin"
		],
		"app/wp-content/mu-plugins/{$name}": [
			"type:wordpress-muplugin"
		]
	},
	"wordpress-install-dir": "app/wp"
}
```

And that's it.

When Composer dumps it's autoload file, a file called `mu-require.php` will be placed into your mu-plugins folder. When WordPress loads this file as an MU plugin, it will find all of the plugins in folders in your MU plugins directory and include those as well.

### Changing the name of the generated file

[](#changing-the-name-of-the-generated-file)

If you need to have control over what the name of the generated file is, you can set it with the following within the extra section of your `composer.json`:

```
"extra": {
	...
	"mu-require-file": "custom-mu-require-filename.php"
}
```

Similarly, if you wish to turn off generation of this file altogether you can do so by setting this to false:

```
"extra": {
	...
	"mu-require-file": false
}
```

Forcing MU Plugins
------------------

[](#forcing-mu-plugins)

Usually when you are using MU plugins, you have some 'normal' WordPress plugins that you want to always be active. They are not always MU-Plugins, though, so it makes no sense to put the `"type": "wordpress-muplugin"` in the `composer.json` file. WP Must-Use Plugin Loader allows you to override the type from `wordpress-plugin` to `wordpress-muplugin` as needed.

To do this, define a `"force-mu"` key in `"extra"` of your `composer.json` file. This key should hold an array of slugs for plugins to force into Must-Use status.

This is compatible with [WPackagist](https://wpackagist.org/). When adding plugins from WPackagist use the plugin's normal slug, not the wp-packagist version.

```
"require": {
	"johnpbloch/wordpress": "*",
	"boxuk/wp-muplugin-loader": "~1.0",
	"wpackagist-plugin/rest-api": "*"
},
"extra": {
	"force-mu": [
		"rest-api"
	],
	"installer-paths": {
		"app/wp-content/themes/{$name}": [
			"type:wordpress-theme"
		],
		"app/wp-content/plugins/{$name}": [
			"type:wordpress-plugin"
		],
		"app/wp-content/mu-plugins/{$name}": [
			"type:wordpress-muplugin"
		]
	},
	"wordpress-install-dir": "app/wp"
}
```

When the `rest-api` plugin is installed, instead of going in the normal plugins folder, it will be pushed over to the mu-plugins folder and loaded automatically with other Must-Use Plugins.

Forcing Unix Directory Separators
---------------------------------

[](#forcing-unix-directory-separators)

If you work on Windows but use a Linux VM to run your development server, you may need to force unix directory separators to make sure the server can find the mu loader script. If so, there's another configuration in the `extra` block you can set:

```
"extra": {
	"force-unix-separator": true
}
```

Modifying the src directory of the mu plugins
---------------------------------------------

[](#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:

```
define('MU_PLUGIN_LOADER_SRC_DIR', WPCOM_VIP_CLIENT_MU_PLUGIN_DIR . '/');
```

Filtering the mu plugins loaded
-------------------------------

[](#filtering-the-mu-plugins-loaded)

You may wish to filer the mu plugins loaded by the mu plugin loader. WordPress does not provide any hook that is early enough to ensure that this filter is registered before the plugins are loaded, so filtering of this list should be applied immediately before the mu-loader is initialised. You can modify the `mu-require.php` file like the below, or create a new file that's alphabetically before `mu-require.php` file in your `mu-plugins` directory.

```
add_filter(
    'lkwdwrd_mupluginloader_get_muplugins',
    function ( array $plugins ):  array {
        unset( $plugins['example/plugin.php'] );
        return $plugins;
    }
);

// Load the mu loader
require_once 'vendor/boxuk/wp-muplugin-loader/src/mu-loader.php';
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Recently: every ~142 days

Total

22

Last Release

1019d ago

Major Versions

1.x-dev → 2.0.0-alpha2022-01-12

PHP version history (5 changes)1.1.1PHP ^7.2

1.4.0PHP ^7.3

1.5.0PHP ^7.3 || ^8.0

2.0.0PHP ^7.3 || ^8.0 || ^8.1

2.1.0PHP ^7.4 || ^8.0 || ^8.1 || ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c8c170d78af034f9aee1c84e279b97e5b61b549ce8b8519ed8da81402ac8e96?d=identicon)[BoxUK](/maintainers/BoxUK)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (51 commits)")[![lkwdwrd](https://avatars.githubusercontent.com/u/1895738?v=4)](https://github.com/lkwdwrd "lkwdwrd (35 commits)")[![jenkoian](https://avatars.githubusercontent.com/u/131355?v=4)](https://github.com/jenkoian "jenkoian (12 commits)")[![Ritchbox](https://avatars.githubusercontent.com/u/86604798?v=4)](https://github.com/Ritchbox "Ritchbox (11 commits)")[![johnpbloch](https://avatars.githubusercontent.com/u/446833?v=4)](https://github.com/johnpbloch "johnpbloch (7 commits)")[![Clorith](https://avatars.githubusercontent.com/u/468735?v=4)](https://github.com/Clorith "Clorith (5 commits)")[![jdamner](https://avatars.githubusercontent.com/u/482959?v=4)](https://github.com/jdamner "jdamner (5 commits)")[![anthonywnz](https://avatars.githubusercontent.com/u/37510788?v=4)](https://github.com/anthonywnz "anthonywnz (3 commits)")[![leoloso](https://avatars.githubusercontent.com/u/1981996?v=4)](https://github.com/leoloso "leoloso (1 commits)")[![nlemoine](https://avatars.githubusercontent.com/u/2526939?v=4)](https://github.com/nlemoine "nlemoine (1 commits)")[![andy-morgan](https://avatars.githubusercontent.com/u/2247922?v=4)](https://github.com/andy-morgan "andy-morgan (1 commits)")

---

Tags

wordpressloadermuplugin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/boxuk-wp-muplugin-loader/health.svg)

```
[![Health](https://phpackages.com/badges/boxuk-wp-muplugin-loader/health.svg)](https://phpackages.com/packages/boxuk-wp-muplugin-loader)
```

###  Alternatives

[lkwdwrd/wp-muplugin-loader

A drop-in MU Plugin loader for WordPress

5847.1k](/packages/lkwdwrd-wp-muplugin-loader)[bueltge/multisite-global-media

Multisite Global Media is a WordPress plugin which shares media across the Multisite network.

22431.2k](/packages/bueltge-multisite-global-media)[bueltge/must-use-loader

Load Must-Use Plugins inside subdirectories with caching. For delete the cache: if you view the Must Use plugin list in the network administration.

6115.7k2](/packages/bueltge-must-use-loader)[szepeviktor/composer-envato

Composer plugin for Envato

3715.2k1](/packages/szepeviktor-composer-envato)[balbuf/composer-wp

Manage WordPress core, plugins, and themes with composer.

173.6k](/packages/balbuf-composer-wp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
