Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Add Post Thumbnail to your WordPress RSS Feeds

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Add Post Thumbnail to your WordPress RSS Feeds

In our earlier tutorial, we showed you how you can add post thumbnails in WordPress. The sad truth is that even if you enable the post thumbnails, it will not show up in your RSS feeds. But we have a solution for that. In this article, we will show you how you can add post thumbnails to your WordPress RSS feeds with a simple function.

All you have to do is open your theme’s functions.php file and add the following code:

function rss_post_thumbnail($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', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

Feel free to style this however you like. Remember to activate WordPress post thumbnails using our main WordPress post thumbnail tutorial before adding it to your RSS.

Source: Dave Redfern

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Bolkya Resha says:

    I tried same for my site but rss feed not showing images,plz help

    • WPBeginner Support says:

      RSS feed is an XML file. Usually when you are viewing an XML file in a browser it will only show you the code and will not execute the markup. You need to check your feed into a feed reader like Feedly.

  2. Natalie says:

    Is it possible to use this function with the WP RSS WIdget? I need to imports POSTs with thumbnails to another site.

  3. Suresh Khanal says:

    It was really a headache to see the RSS-to-email campaigns without no images because the RSS feed did not have the necessary tag to pull images from. Anyway, changed the functions.php file and now MailChimp can pull the required components and now the emails look beautiful.

    However, still the images in RSS feed look really big and wish to resize them to a suitable size. Needs to search more and find a solution for this.

  4. Elodie says:

    Thank you it crashed my site! ;)

  5. Jeremy R. Hammond says:

    This accomplished getting the thumbnail included in the feed, but created two other problems:

    1) My feed now shows the full content instead of just the summary.

    2) The feed is also capturing my featured image from the content (the full image, not just the thumbnail) and this shortcode:

    [caption id="attachment_24496" align="aligncenter"width="739"]Caption Text[/caption]

    I assume there’s a way to correct both of these problems. Can anyone assist?

  6. Gretchen Louise says:

    Thank you so much for this code! Any suggestions for editing it so that the post thumbnail is a link to the post itself?

  7. Keifer Moore says:

    I tried to implement this and received “Parse error: syntax error, unexpected ‘<' in /home/content/98/8201898/html/wp-content/themes/twentyfourteen/functions.php on line 526"
    I can't access wp-admin or the rss feed. I've tried making new wp-config.php files and nothing's working. Could someone help?

  8. Salvatore Capolupo says:

    Great help, thank you

  9. I Plank says:

    thanx a lot. it works

  10. Benjamin says:

    Hi whoever wrote this post. Thanks at first, but when using this code, my feed displays the image in FULL SIZE, not as a thumbnail. What would you recommend to define a size?

  11. vijay saklani says:

    i am new to wordpress. can you suggest me how can i use this one to show rss fedd with thumbs. here is my code:

    get_item_quantity( 10 );

    // Build an array of all the items, starting with element 0 (first element).
    $rss_items = $rss->get_items( 0, $maxitems );


    <a href="get_permalink() ); ?>”
    title=”get_date(‘j F Y | g:i a’) ); ?>”>
    get_title($content,) ); ?>

    get_description() ); ?>

    and add the describe function in function.php of theme. but not working.

    Help me!!!!

  12. François says:


    Thanks you for sharing this!

    I’d like to know if this is possible (and how) to use this script to display author image in rss feed? Is there a way to do this ?



  13. Kama says:

    Why we need check has_post_thumbnail()?

    get_the_post_thumbnail() return empty string if it couldn’t get thumbnail. Also, no need to define global $post. Filters calling from inside the loop.

    And why we call get_the_content(), is it nessesary?

    This code will enaugh:

    function rss_post_thumbnail( $content ){
    $img = get_the_post_thumbnail( null, array(100, 80), array( ‘align’ => ‘left’, ‘style’ => ‘margin-right:15px;’ ) );
    $content = $img . $content;

    return $content;
    add_filter( ‘the_excerpt_rss’, ‘rss_post_thumbnail’ );
    add_filter( ‘the_content_feed’, ‘rss_post_thumbnail’ );

    Sorry for my english. It’s not my native.

  14. Abhay Singh says:

    Hello sir, I have added code on functions.php but thumbnail not showing

  15. Brett Bumeter says:

    Trying this with the genesis magazine theme, no luck. The article is getting a wee bit dated. I was wondering if something might have changed in wordpress since this was originally written, or if maybe I’m just missing something. Been a while since I wondered down the rabbit hole chasing feed code

    /** Add thumbnail to Magazine theme feed*/
    function rss_post_thumbnail($content) {
    global $post;
    if(has_post_thumbnail($post->ID)) {
    $content = ” . ‘ID).'”>’. get_the_post_thumbnail($post->ID).’‘ .
    ” . /* full content option get_the_content() */get_the_excerpt();/*exercpt option */
    return $content;

    add_filter(‘the_excerpt_rss’, ‘rss_post_thumbnail’);
    add_filter(‘the_content_feed’, ‘rss_post_thumbnail’);

    • Editorial Staff says:

      Just tested the code from the article on a custom genesis child theme. It works fine. It won’t work with the default WordPress feed that firefox shows. But if you go to the atom feed, then it will work. If you are using a feedburner or another app, it should work.

  16. Nick Aster says:

    Ok…. wait a minute.

    Looks like this forces my RSS feed to be full content. Is that the case?

    More importantly, it looks like all this does is slap the tumbnail at the beginning of the content in the RSS feed. Am I missing something here?

    • Editorial Staff says:

      Yes, it does make the feed full content. You can change get_the_content() to get_the_excerpt().

      Yes, the point is to add the featured thumbnail in RSS. In most cases, that is added before the post. You can style the paragraph tag however you like. Add a float:left; or anything that you want.

  17. shen says:

    10x .. it’s work perfectly :D

  18. eribowo says:

    is this working for RSS reader wordpress widget…?? i looking for way to insert thumbnails image in rss widget..anyone..?

  19. laksh says:

    Hi i tried this but it gives error Fatal error: Call to undefined function add_filter() in wp-includes/functions.php on line 33 . please help me to solve this porblem. thanx in advance.

  20. AndyiBM says:

    This works great, except that when there is a thumbnail present, the feed always repeats the post title within the content text (or excerpt text, as I’m using), which looks a little redundant. For posts without a thumbnail, the title is not repeated. Is there any way of removing this extra title text? It has no surrounding tags, so I can’t hide it using CSS.

  21. Piotr Sajnog says:

    Is there anyway to align post thumbnails to the left of the entry in RSS feed?

    • Editorial Staff says:

      Yes, add styling to it. Change the Paragraph tag into a Div and tell it to float left with some margin.

  22. AzzePis says:

    I think it’s better if you change code:


    to maintain the original content.

    • Meg says:

      so what would the final code – all of it – look like?
      Non-coder who wants a thumbnail in her blog feed.

      • Editorial Staff says:

        The code in the article is the final code that you need… ofcourse if your theme doesn’t have thumbnail enabled, then you will need more.

  23. Cosmin says:

    How would you make the post thumbnail link from RSS to the post?

    I don’t get along with PHP, any help is appreciated :)

    • Editorial Staff says:

      You would modify the function a little bit. Add this php code in the link tag: the_permalink($post->ID)

  24. Jake says:

    This is really something! I would love to add something like this to Inside the Webb, I’ll have to mess around with some code and see what I can do.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.