Images not served on the CDN when passed through custom code.

When I pass images using wp_get_attachment_image_src(), they do not get over the CDN.

I tried WP_Smush::get_instance()->core()->mod->generate_cdn_url( wp_get_attachment_image_src($thumbnail_id,true)[0] ); but that does not work.

  • Adam
    • Support Gorilla

    Hello Harumitu Miyashita

    I hope you’re well today and thank you for your question!

    I did check the “wp_get_attachment_image_src()” function on my test site: I’ve edited one of my theme templates to use that function based on the code that you shared during the chat. The Smush CDN worked fine with it and was serving images as expected.

    I did check your site the and I noticed that it’s quite a complex setup so before we move any further with this troubleshooting, I’d like to ask you to do some additional tests on your site. I didn’t do it because it’s a live site and I didn’t want to do anything without your permission.

    That being said, could you please disable lazy load plugin and all the image-optimization related plugins/options on the site (except Smush and its CDN feature), clear all caches after that (on site and on server – if there is any) and then check again?

    I think something’s conflicting here or there’s something more into the issue than just the fact that this functions is used so I’d like to check it.

    Let me know here about test results, please, and we’ll then decide what steps to take next to solve the case.

    Kind regards,

    Adam