Hi There!
Okay. I’m a bit baffled, and I think the problem lies with however you connect with the CDN.
When I get the main featured image (which uses the function wp_get_attachment_image_url()
), the CDN connection plugin that is used on your site filters the URL from the Image URL on the site to the Image URL on the CDN uses. However, when I use wp_get_attachment_image_srcset()
to get the srcset (which is needed in your case as the featured image is smaller), it returns the non-CDN version of the URL. Weirdly, they both use wp_get_attachment_image_src()
, which filters both, so there’s something within the plugin you use to setup the CDN that says “ignore it from the srcset”.
I’m marking this as resolved, as you’re going to need to speak to whoever makes that plugin, as I think that’s where the issue is. Happy to assist them in whatever they do :).