How to tell if Jetpack’s Photon is active?

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

http://plugins.trac.wordpress.org/changeset/716884

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() ) {}

It’s a slightly tidier way than querying the option directly.

Leave a Comment