WordPress Black Friday & Cyber Monday Deals 2021
Days
Hours
Minutes
Seconds

How to Disable Photon in JetPack

Just a quick tip to share how you can disable Photon, one of the features in Jetpack. A reason to do this might be to have more control over the cropped and resized images it generates. You just need to go to the JetPack page, then click on 'Learn more' in the Photon box, and then 'Deactivate'.

Just a quick tip to share how you can disable Photon, one of the features in Jetpack. A reason to do this might be to have more control over the cropped and resized images it generates.

You just need to go to the JetPack page, then click on ‘Learn more’ in the Photon box, and then ‘Deactivate’.

There’s also a way to do it via code:

/* Remove Photon on this site */

$photon_removed = remove_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ) );

// Call wp_get_attachment_image(), wp_get_attachment_image_src(), or anything else that ultimately calls image_downsize()

if ( $photon_removed )
	add_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ), 10, 3 );

If you want to confirm whether JetPack is active, you can use this code:

add_action( 'admin_notices', 'wpse_75103_active_jetpack_modules' );

function wpse_75103_active_jetpack_modules() 
{
    if( !current_user_can( 'delete_users' ) )
        return;

    $jetp = get_option( 'jetpack_active_modules' );

    $photon_active = ( in_array( 'photon', $jetp ) ) ? 'is' : 'is not';
    echo '<h1>Photon ' . $photon_active . ' active</h1>';

    echo '<h2>All JetPack Options</h2>';
    echo '<pre>' . print_r( $jetp, true ) . '</pre>';
}

If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.

Jean Galea
Jean Galea
Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Consider sharing this post so others can find it:

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on telegram
Share on whatsapp
Share on pocket
Share on email

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services just like this one every week.

Our Sponsors
Solid Affiliate
Contents

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

The Beginner’s Handbook
From an introduction on how WordPress works to our recommendations on products and services.
👋 Hey there! We're Gaby and Mark
Every week we share tutorials and genuine reviews of WordPress products and services in our newsletter.
Thousands of people read it!
We’d love for you to join.
We’d love for you to join. Here’s what you’ll be getting:

A single weekly email directly to your inbox.