Created
August 12, 2015 02:33
-
-
Save austinginder/a949ac389bb9cf7b63fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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