Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active April 25, 2016 20:27
Show Gist options
  • Save robneu/7710985 to your computer and use it in GitHub Desktop.
Save robneu/7710985 to your computer and use it in GitHub Desktop.
Disable unwanted Jetpack Modules. The whitelist array will allow any modules you want to remain enabled to continue to function. If you don't want the module to activate, remove it from the whitelist.
<?php
add_filter( 'jetpack_get_available_modules', 'prefix_hide_jetpack_modules' );
/**
* Disable all non-whitelisted jetpack modules.
*
* As it's written, this will allow all of the currently available Jetpack
* modules to work display and be activated normally.
*
* If there's a module you'd like to disable, simply comment it out or remove it
* from the whitelist and it will no longer be available for activation.
*
* @author WP Site Care
* @link http://www.wpsitecare.com/disable-jetpack-modules/
* @param array $modules the existing list of Jetpack modules
* @return array $modules the amended list of Jetpack modules
*/
function prefix_hide_jetpack_modules( $modules ) {
// A list of Jetpack modules which are allowed to activate.
$whitelist = array(
'after-the-deadline',
'carousel',
'comments',
'contact-form',
'custom-content-types',
'custom-css',
'enhanced-distribution',
'gravatar-hovercards',
'infinite-scroll',
'json-api',
'latex',
'likes',
'manage',
'markdown',
'minileven',
'monitor',
'notes',
'omnisearch',
'photon',
'post-by-email',
'protect',
'publicize',
'related-posts',
'sharedaddy',
'shortcodes',
'shortlinks',
'site-icon',
'sso',
'stats',
'subscriptions',
'tiled-gallery',
'vaultpress',
'verification-tools',
'videopress',
'widget-visibility',
'widgets',
);
return array_intersect_key( $modules, array_flip( $whitelist ) );
}
@robneu
Copy link
Author

robneu commented Nov 30, 2013

A full explanation of this code can be found here: http://www.wpsitecare.com/disable-jetpack-modules/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment