Skip to content

Instantly share code, notes, and snippets.

@tylerdigital
Created June 4, 2012 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerdigital/2871384 to your computer and use it in GitHub Desktop.
Save tylerdigital/2871384 to your computer and use it in GitHub Desktop.
Automatically activate Inform About Content plugin only on P2 blogs (WordPress multisite)
add_filter('option_active_plugins', 'p2_filter_active_plugins');
function p2_filter_active_plugins($active_plugins) {
if(get_template()!='p2') return $active_plugins;
$required_plugins = array(
'inform-about-content/inform-about-content.php'
);
foreach ($required_plugins as $key => $plugin) {
if(!(in_array($plugin, $active_plugins))) $active_plugins[] = $plugin;
}
return $active_plugins;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment