We’ve recently enabled the Smush CDN on our website, and it’s working great so far, but there’s some images that aren’t being served over the CDN. The three examples I’ve noticed are:
1. Images output as a background image in a style attribute with wp_get_attachment_image_url().
2. Image URLs in a <source> tag for a <picture> element, also from wp_get_attachment_image_url().
3. Image URLs manually passed to a srcset attribute of wp_get_attachment_image() using wp_get_attachment_image_url().
These are all images that are output in our (bespoke) theme’s template files. I’m assuming they’re not served from the CDN because whatever method the plugin uses to find and upload images is just based on the src attribute of img tags, but what I was hoping to find is whether there is a function or filter I can use inside the template files to manually indicate images that need to be uploaded. Something like the (now deprecated) filter that the WP Offload S3 Assets add-on supported: https://deliciousbrains.com/wp-offload-media/doc/get-asset-url/
Does anything like this exists? Is there a way for us to serve these images using the CDN? Even if we had to manually specify the dimensions.