I have a site I work on that publishes news wires and they post news wires and it is a requirement for the images in the post to be from their image respository so an external URL. The problem is that the images in the RSS feed now pulls that in as well but the path is incorrect.

The solution I am looking for is a function I can add to the functions.php that will set to exclude images from external sources (URLS) in the RSS feeds.

Current output example of a image in the content from an external URL:

<media:thumbnail url="(removed https).mydomain.com/images.sourcedomain.com/files/409461/original/file-20210702-13-pxz54n.jpg?ixlib=rb-1.1.0&#038;q=45&#038;auto=format&#038;w=754&#038;fit=clip" />
        <media:content url="(removed https).mydomain.com/images.theconversation.com/files/409461/original/file-20210702-13-pxz54n.jpg?ixlib=rb-1.1.0&#038;q=45&#038;auto=format&#038;w=754&#038;fit=clip" medium="image"/>

You will see that it adds the domain mydomain.com to the front of the source domain images.theconversation.com where it should just exclude those images from feeds if the source is from an external domain.

Thank you in advance for any help.

  • Is that built-in WordPress RSS feed code? I don't think WordPress knows about the media namespace out of the box. (SimplePie does, but I don't think WordPress uses it to construct RSS)
    – Rup
    Jul 4 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.