Display Featured Post Thumbnails In WordPress Feeds

How to Display Featured Post Thumbnails In WordPress Feeds

in RSS Feeds
Google+ LinkedIn

WordPress does not allow featured post thumbnails in feeds even if you enable the post thumbnails support. But we have a solution for that. Here is how you can add post thumbnails to your WordPress RSS feeds with a simple function.

Just copy and paste this code snippet in your theme functions.php file and your RSS feeds will display featured post thumbnails along with content.

// display featured post thumbnails in WordPress feeds
function wcs_post_thumbnails_in_feeds( $content ) {
    global $post;
    if( has_post_thumbnail( $post->ID ) ) {
        $content = '<p>' . get_the_post_thumbnail( $post->ID ) . '</p>' . get_the_content();
    }
    return $content;
}
add_filter( 'the_excerpt_rss', 'wcs_post_thumbnails_in_feeds' );
add_filter( 'the_content_feed', 'wcs_post_thumbnails_in_feeds' );

Share the love

If you like this snippet, share it with others!

5 Replies on "Display Featured Post Thumbnails In WordPress Feeds"

  1. zkanoca

    I have applied you told. It is working well. But I want to get imgURL and imgTitle as seperate XML key elements. How can I do that?

    1. Nick Fisher Post author

      You will have to create and customize feed template for that.
      Let me know if you need help with that. ;)

  2. Dirk

    Thanks for this help. I was shocked when i first saw my feed in feedly. After i applied this changes i get the correct result.

    1. Thanks Dirk for your feedback,

      I’m glad you found it useful :)

  3. Sladjan

    I added this code snippet but it wont work with MailChimp online editor. It adds inside tag. I even changed to:
    $content = ‘ID), ‘thumbnail’) . ‘” medium=”image” type=”image/png”/> ‘ . get_the_content();

    but it still wont work. Is there other way to add to RSS Feed and that it works with *|FEEDITEM:IMAGE|* or *|RSSITEM:IMAGE|* ?

Leave a Reply

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