apply_filters ( 'jetpack_get_available_modules', array $modules, string $min_version, string $max_version )

Filters the array of modules available to be activated.

Source file: class.jetpack.php

View in GitHub

Parameters

$modules

(array) Array of available modules.

$min_version

(string) Minimum version number required to use modules.

$max_version

(string) Maximum version number required to use modules.


Changelog

Since: Jetpack 2.4.0


Notes

That filter allows you to change the list of modules that can be activated and deactivated by admins. For example, if you didn’t want anyone to be able to activate the Stats module on your site, you could do this:

function jeherve_kill_stats( $modules, $min_version, $max_version ) {
    unset( $modules['stats'] );
    return $modules;
}
add_filter( 'jetpack_get_available_modules', 'jeherve_kill_stats', 20, 3 );

Have a note to contribute?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Comments

  1. // Enable only Jetpack Search
    add_filter(
        'jetpack_get_available_modules',
        static function ($modules) {
            return array_intersect_key($modules, ['search' => true]);
        },
        10,
        1
    );