boxuk / wp-muplugin-loader

A drop-in MU Plugin loader for WordPress
MIT License
19 stars 4 forks source link

[FEATURE] Add a filter for loaded plugins #118

Closed jdamner closed 1 year ago

jdamner commented 1 year ago

Change Details

Adds support for the MU plugins that are about to be loaded to be filtered.

Typically filtering of this list should be applied before the mu-loader is initialised.

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

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