I want to disable specific plugins on specific frontpages, but not "disable" them in the backend, i.e. really disable them in the DB. Just NOT load them, as if they weren’t installed.
Did this via mu-plugin very early in the code:
function strposa($haystack, $needles=array(), $offset=0) { // Like strpos for an Array of needles
foreach($needles as $needle) {
if(strpos($haystack, $needle, $offset) !== false)
return true;
}
return false;
}
add_filter('option_active_plugins', function ($plugins)
{
if(!wp_doing_ajax() && !wp_doing_cron() && !is_admin())
{
$remove_plugins_frontpage = array('duplicator-pro',
'block-specific-plugin-updates',
'delete-expired-transients');
foreach($plugins as $key => $plug) {
if(strposa($plug, $remove_plugins_frontpage))
unset($plugins[ $key ]);
}
}
return $plugins;
});
I.e. do as if for example Duplicator wouldnt be installed, because I dont need all the frontend actions in my frontend. I just need Duplicator in the backend AND during Cron calls.
Unfortunately, this disables the plugins mentioned above also in the DB. That means: When I go to the backend, those plugins are disabled which is quite bad.
Any ideas how to circle around this problem?
Thanks so much