Disable the Jetpack Photon module so that you can work with WordPress' image functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// do not include the opening php tag | |
// turn Photon off so we can get the correct image | |
$photon_removed = ''; | |
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) { // check that we are, in fact, using Photon in the first place | |
$photon_removed = remove_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ) ); | |
} | |
// do things with image functions | |
// turn Photon back on | |
if ( $photon_removed ) { | |
add_filter( 'image_downsize', array( Jetpack_Photon::instance(), 'filter_image_downsize' ), 10, 3 ); | |
} |
@hananloser You can see how this is used in an RSS media attachment plugin I created:
@robincornett THANKS for the Jetpack check, that's important!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where i put this code