Skip to content

Instantly share code, notes, and snippets.

@austinginder
Created August 12, 2015 02:33
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 austinginder/a949ac389bb9cf7b63fd to your computer and use it in GitHub Desktop.
Save austinginder/a949ac389bb9cf7b63fd to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Anchor Multisite Jetpack Control
Description: Auto activate and disable select Jetpack modules
Version: 1.0
Author: austinginder
Author URI: http://austinginder.com
Network: true
License: GPL2
*/
// Auto activate the following Jetpack modules
function activate_jetpack_modules( $modules ){
$modules = array(
'shortcodes',
'widget-visibility',
'tiled-gallery',
'json-api',
'publicize',
'custom-css',
'widgets',
'manage',
'subscriptions',
'stats',
'carousel',
'photon',
'sharedaddy',
'omnisearch',
'sso',
'monitor',
'markdown',
'related-posts',
'site-icon',
);
return $modules;
}
add_filter( 'option_jetpack_active_modules', 'activate_jetpack_modules' );
// Disable auto activate the following Jetpack modules
function disable_jetpack_autoactivate( $modules ) {
return array_diff( $modules, array(
'contact-form',
'vaultpress',
'gravatar-hovercards',
));
}
add_filter( 'jetpack_get_default_modules', 'disable_jetpack_autoactivate' );
// Blacklist the following Jetpack modules
function blacklist_jetpack_modules( $modules ){
$jp_mods_to_disable = array(
'protect'
);
foreach ( $jp_mods_to_disable as $mod ) {
if ( isset( $modules[$mod] ) ) {
unset( $modules[$mod] );
}
}
return $modules;
}
add_filter( 'jetpack_get_available_modules', 'blacklist_jetpack_modules' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment