Conditionally bypass plugin

I would like to defer the loading of an othervise active plugin for certain pages.

Since all plugins reside in the same folder, and WordPress only loads the activated ones, it must have an array of active plugin-handles at some point that it goes through. There’s probably even a filter available to modify this array just before its being read (I’m hoping..).

Read More

So is it possible to conditionally bypass the loading of an otherwise active plugin, by removing it’s handle from the list of active plugins, dynamically, without deactivating the plugin using deactivate_plugins()?

Related posts

1 comment

  1. The list of active plugins is provided by wp_get_active_and_valid_plugins() during core load and comes from active_plugins option (multisite details aside).

    While there is no explicit filter for it as any option it can be filtered via 'option_' . $option hook (so option_active_plugins) and mu-plugin (which are being loaded earlier) should be able to do it.

    Note that it is more common and better practice to control what plugin does (such as thing it hooks) rather than if it loads completely.

Comments are closed.