bueltge / must-use-loader

This small WordPress plugin include all plugins in subdirectories from Must Use plugin folder
MIT License
62 stars 20 forks source link

Ability to exclude plugins from loader #10

Closed cfoellmann closed 6 years ago

cfoellmann commented 6 years ago

Usecase: I run (try to run) Mercator (https://github.com/humanmade/Mercator) for domain mapping. It is included in sunrise.php and the folder(s) sit in mu-plugins. Now I don't want it to be loaded by the must-use-loader.

I wasn't sure if filters work so early but I tested and the code I added works. Not sure if there are any situations this can lead to issues.

Filter usage:

function prefix_unset_autoloading( $mu_plugins ) {

    unset($mu_plugins["mercator-gui/gui.php"]);
    unset($mu_plugins["mercator-sso/sso.php"]);

    return $mu_plugins;
}
add_filter( 'mustuse_loader_mu_plugins', 'prefix_unset_autoloading' );
bueltge commented 6 years ago

Merged. Thanks a lot!