Featured Image in RSS Feed

RSS Feeds are something that is often overlooked when creating your website. Out of the box, WordPress provides you with a feed of your posts, categories, etc. If you plan on publishing content on a regular basis and growing your audience, your RSS feed will be critical. There’s a few things that you can do to make sure that your RSS stands out, one of which is making sure that the post’s featured image is in the RSS feed

If you do nothing else to your RSS feed content, adding your post’s featured image will make your blog’s presentation that much more enjoyable. I personally use Feedly for my RSS content consumption. This is how my feed looks without and with the featured images with the posts. Personally, if I saw a He-Man image, I’d like to at least see what that post is about.

RSS Feed Without Images
RSS Feed with Images

[code lang=”php”]
function rss_post_thumbnail($content) {
global $post;

if(has_post_thumbnail($post->ID)) {
$content = ” . get_the_post_thumbnail($post->ID) . ” . get_the_content();
return $content;
add_filter(‘the_excerpt_rss’, ‘rss_post_thumbnail’);
add_filter(‘the_content_feed’, ‘rss_post_thumbnail’);

This code will take the current post id and the post image for that id and add it to the RSS feed using the_excerpt_rss and the_content_feed hooks. Drop this into your functions.php file and your RSS feed will now have images. As an aside to this, RSS feed readers do not instantly update. You may have to verify your change by going into the browser and accessing your feed directly. So please, try not to bash your head against the wall trying to figure out why your reader of choice isn’t picking up the images, they will.

/ Jason Resnick

Jason is a WordPress developer helping small businesses, design and marketing agencies achieve their goals by specializing in Ecommerce and increasing conversions. Learn more about him here.

More Posts | Twitter | Work ON Your Business Challenge | Coaching

5 responses to “Featured Image in RSS Feed

  1. Hi Jason,

    I’ve been searching for a way to do this, and found your solution simple an elegant. However, when I try to implement it in my twentyeleven child theme, i get a parse error whenever I try to save functions.php after adding that chunk of code:

    Parse error: syntax error, unexpected ‘&’

    Should I do anything else? I can’t notice what is wrong.


  2. Sorry, silly of me!! I just had to replace the “>” for “>” … however, even if I check the not cached version of my feed, I still don’t see featured images there 🙁 My description and content start with The Title, author and date of the post links :-/

    1. No worries @Fran — RSS doesn’t update immediately. Plus what happens is that, at least from my experience, once your post makes it to the feed, that’s it. Only new posts will get the changes.

Leave a Comment

Your email address will not be published. Required fields are marked *