Check if Jetpack Modules Are Enabled

It’s pretty easy to check if a Jetpack module is active:

$jetpack_active_modules = get_option('jetpack_active_modules');
if ( class_exists( 'Jetpack', false ) && $jetpack_active_modules && in_array( 'your-module', $jetpack_active_modules ) ) {
      // Do something

Here’s some popular module names you might be looking for:

  • carousel
  • contact-form
  • custom-css
  • gravatar-hovercards
  • infinite-scroll
  • minileven (mobile theme)
  • sharedaddy
  • shortcodes
  • widgets

About Devin

I'm a WordPress developer based in Austin, Texas. Follow my projects on GitHub, or more general WordPress ramblings as @devinsays on twitter.

5 Responses

  1. This will still evaluate to true if Jetpack is de-activated after the option has been set at some point. Adding a check for the class seems to help:

    if ( class_exists( 'Jetpack', false ) ) {
    $jetpack_active_modules = get_option('jetpack_active_modules');
    if ( $jetpack_active_modules && in_array( 'sharedaddy', $jetpack_active_modules ) ) {
    // We're good to go!

  2. We just committed a new function to Jetpack Trunk, and it should be enabled in the next release, Jetpack::is_module_active()

    Then you can just call:

    if( class_exists( ‘Jetpack’ ) && Jetpack::is_module_active( ‘contact-form’ ) ) {}

    Or at least, you will once the next version releases, and the user has their Jetpack updated. :) If you’d like to preserve the backward compatability, you can just do:

    if( class_exists( ‘Jetpack’ ) && in_array( ‘contact-form’, Jetpack::get_active_modules() ) {}

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>