In this tutorial, I’ll show you how easy it is to add a featured image from all your posts anywhere in your RSS feed. This tip works regardless of whether you’re using Feedburner or your default WordPress RSS feed address.

Follow the steps below to add featured images to your RSS Feed in WordPress:

Step 1

We need to add some code to your functions.php file, so first go to the appearance editor.

wordpress-appearance-editor

Step 2

Scroll down and find your functions.php file.

theme-functions

Step 3

Then put the following code at the bottom of your functions.php file (If you don’t know what you are doing, make sure to backup your functions.php file before editing it).

function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content;
}
return $content;
}

add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

Step 4

In the above code we used medium for the thumbnail size. This will appear like our RSS feed below. You could change this to thumbnail or full if you prefer. Medium seems to work the best for all platforms.

Note: Some RSS feed management services like Feedburner may cache your feed which means you may need to wait for it to update before your featured image displays. You can Ping Feedburner so it updates immediately.

Featured Image via Plugin

If you want an even easier way of including a featured image in your feed items, you can use the Add Featured Image to RSS Feed plugin. It’s a simple plug and play solution. This plugin does one thing, and that thing is to add your posts’ featured image to the RSS feed. It specifies the ‘large’ image size.

Published by jean

11 Comments

  1. This is great! Although, my image is added to the tag in the RSS feed. How can I get it into a separate tag (like “image” or whatever is best practice)?

    Reply
    • “Description” was deleted in my original post. It should read:
      my image is added to the “description” tag in the RSS feed…

      Reply
  2. Hi Luke,

    You can add a custom node to the rss feed as explained in this link http://codex.wordpress.org/Plugin_API/Action_Reference/rss2_item

    Reply
  3. It was really troublesome and my RSS-to-Email campaigns look ugly and unprofessional. Finally, succeeded in setting it up correctly and it’s great now.

    Thanks for the useful post.

    Reply
  4. Hi all,

    I followed this tutorial and it didn’t work, we’re using WordPress 3.9.8 basically adding this function to the theme’s function.php then calling it has no effect on the RSS feed, would advise against trying this and perhaps going with the plugin option – may be this blog is simply out of date?

    Reply
    • Hi R Davies, may I ask why you’re using such an older version of WordPress? It’s best to test these things out on the latest versions. Either way, using the plugin method is better than modifying theme files, so yeah, you can go with that.

      Reply
  5. Is there a way to add the featured image to my rss feed in a way that it will show as hyperlinked back to the post it is associated with?

    I use my feed to trigger a newsletter with my new content currently, and the title automatically hyperlinks. but the image does not (even though people obviously will try to click through from the image).

    Is there a way to define how the image is added to the feed so that it would also inherit the hyperlink? or is this something I need to sort out on the campaign side? Seems so simple, but can’t find a solution for this.

    Reply
    • Hi – Were you able to find a solution to this problem? I’m looking for the same thing. “Is there a way to add the featured image to my rss feed in a way that it will show as hyperlinked back to the post it is associated with? “

      Reply
  6. To link the featured image to its post, replace this line of code:

    $content = ” . get_the_post_thumbnail( $post->ID, ‘thumbnail’, array( ‘style’ => ‘float:left; margin:0 15px 15px 0;’ ) ) . ” . $content;

    with this:

    $content = ‘‘ . get_the_post_thumbnail( $post->ID, ‘thumbnail’, array( ‘style’ => ‘float:left; margin:0 15px 15px 0;’ ) ) . ‘‘ . $content;

    Reply
    • It formatted my code into a link 🙁

      Trying again…

      To link the featured image to its post, replace this line of code:

      $content = ” . get_the_post_thumbnail( $post->ID, ‘thumbnail’, array( ‘style’ => ‘float:left; margin:0 15px 15px 0;’ ) ) . ” . $content;

      with this:

      $content = ” . get_the_post_thumbnail( $post->ID, ‘thumbnail’, array( ‘style’ => ‘float:left; margin:0 15px 15px 0;’ ) ) . ” . $content;

      Reply

Leave a Reply to Ryan Cancel reply

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