Skip to content

Instantly share code, notes, and snippets.

@ethitter
Last active July 18, 2017 00:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ethitter/5988344 to your computer and use it in GitHub Desktop.
Save ethitter/5988344 to your computer and use it in GitHub Desktop.
Disable Jetpack's Photon module for certain calls to WordPress image functions
<?php
// See https://ethitter.com/p/897/
$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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment