Smush CDN on RSS feed

So Smush adds data to my images which gets put in my feeds, which causes them to not validate.

  • Rupok
    • Ex Staff

    Hi Nathan,

    So sorry for the time it’s taking. We try to resolve issues as soon as possible. But some issues may need a little longer depending on the complexity of the problem. I’m confirming you that the issue is already escalated to our Second Level Support team and they are currently working on this. We will update you here as soon as we get anything from them.

    I really appreciate your patience.

    Regards,
    Rupok

  • Maciej Palmowski
    • Recruit

    Hi Susan

    The main problem was not the CDN itself, but lazy-loading and the fact how get_post_thumbnail generates it’s html code.

    To fix your problem we did three things:
    – uploaded an mu-plugin – https://gist.github.com/palmiak/11f48197f524dd2808ba6ca9e86aa07e – it makes sure that we won’t add lazy-loading in RSS Feed. The main problem was adding the data-src tag. With this plugin we disable this in the feed.
    – removed get_post_thumbnail from the wpbuilds_post_thumbnails_in_feeds() and used wp_get_attachment_image_src instead – get_post_thumbnail generated some img attributes like size for example which broke the feed validation. With wp_get_attachment_image_src we just get the image url we need.
    – removed the skip_smush filters for CDN, as we should serve the images from CDN even in feed and they won’t cause any problem now.

    The RSS Feed still doesn’t validate but it’s caused by some of the podcast plugins – would you like us to have a look there?