Jetpack’s Photon and wp_get_attachment_image_src()
-
Hi.
My question is how to get the “real” image src out ofwp_get_attachment_image_src
when Jetpack’s Photon is enabled?The full story here is that I have a plugin that needs to alter the src of images. When Photon is enabled it takes total control and prepend the hostname to the CDN. I need the url without that prefix.
I try to disable it for a specific image with
add_filter( 'jetpack_photon_skip_image', '__return_true' );
which works well for the src attribute in the image tag, but, for responsive images the srcset is still prefixed with the CDN hostname. So looks like thejetpack_photon_skip_image
trick does not apply for references in srcset.My plugin adds a filter to
wp_calculate_image_srcset
which in turn try to get the real urls fromwp_get_attachment_image_src().
Still prefixed with CDN hostname. So looks likejetpack_photon_skip_image
does not apply there either.I’ve also tried this hack: https://ethitter.com/2013/07/disable-jetpacks-photon-module-in-specific-situations/ but still the srcset is prefixed.
Any ideas?
- The topic ‘Jetpack’s Photon and wp_get_attachment_image_src()’ is closed to new replies.