Automattic / vip-go-mu-plugins

The development repo for mu-plugins used on the WordPress VIP Platform.
https://docs.wpvip.com/
GNU General Public License v2.0
195 stars 100 forks source link

Support client mu-plugins #166

Closed joshbetz closed 6 years ago

joshbetz commented 8 years ago

https://github.com/WordPress/WordPress/blob/703d5bdc8deb17781e9c6d8f0dd7e2c6b6353885/wp-settings.php#L210-L223

Can we do this without breaking the muplugins_loaded hook? How early is add_action available? Can we add a hook before mu-plugins are loaded and include them there?

nickdaugherty commented 8 years ago

The trick is bootstrapping. WP core will include files in mu-plugins automatically, but there isn't a way for us to tell WP to include files from another folder.

Probably the only way to do it is to have clients include a 000-vip-init.php file in their own mu-plugins in every repo that bootstraps the Go plugins.

joshbetz commented 8 years ago

We could hijack wp_get_mu_plugins() to load a file which itself loads our mu-plugins and the clients' mu-plugins by manipulating WPMU_PLUGIN_DIR.

https://github.com/WordPress/WordPress/blob/703d5bdc8deb17781e9c6d8f0dd7e2c6b6353885/wp-settings.php#L210-L213 https://github.com/WordPress/WordPress/blob/703d5bdc8deb17781e9c6d8f0dd7e2c6b6353885/wp-includes/load.php#L525-L539

This gets very much in the realm of vipd.

mjangda commented 7 years ago

Possible simpler option:

The trade-off is that client mu-plugins load later (although, still before muplugins_loaded) but I think that's okay.

joshbetz commented 7 years ago

We could probably even call it mu-plugins in the vip-skeleton repo and map it as client-mu-plugins in the container, although that may be too confusing.