How to load only a specific Jetpack module

Sometimes you do not want to see a specific module in the Jetpack menu. You might not use it at all, or you might want to make sure other admins can’t activate it.

For such cases, you can use the jetpack_get_available_modules filter to control the list of modules available in Jetpack.

Load only a specific Jetpack module

function tweakjp_only_stats ( $modules ) {
    $return = array();
    $return['stats'] = $modules['stats'];
    return $return;
add_filter( 'jetpack_get_available_modules', 'tweakjp_only_stats' );

Disable a specific module

function tweakjp_disable_stats ( $modules ) {
    unset( $modules['stats'] );
    return $modules;
add_filter( 'jetpack_get_available_modules', 'tweakjp_disable_stats' );
This entry was posted in Code snippets, Tips & Tricks and tagged , , , . Bookmark the permalink.
  • Recent Comments

    Kraft on Jetpack 3.8.1 – WordPres…
    René on Jetpack 3.8.1 – WordPres…
    Derek Smart on Jetpack 3.8.1 – WordPres…
    Joseph on Jetpack 3.8.1 – WordPres…
    Gary Jones on Jetpack 3.8.1 – WordPres…
  • Archives

  • Install Jetpack to see our line-up of features.

    Install Jetpack Now

    Don’t need all Jetpack’s features? No problem. Only activate what you need!


    Get every new post delivered to your Inbox.

    Join 54,186 other followers

    %d bloggers like this: