Blogging 101

How to show featured image in WordPress RSS feed without any plugins

In my last Blogging 101 post, I talked about adding the Related Posts Section to your articles without using any plugins. Today, I am sharing with you a very simple code hack to include featured images in your blog’s RSS feed.

But first, why to show featured image in WordPress RSS Feed?

  • Without any images, the RSS feed is very drab/boring and does not necessarily motivate users to click through to your site. Adding featured images increases the view factor of your feeds.
  • Also, if you are using your RSS Feed to send out email notifications to subscribers every time a new post is published on your site, then including the featured image in your feed will automatically add it to your notification emails as well, making the emails much better-looking and attractive.

So, here’s how to do it for the PHP coding enthusiasts out there:

How to show featured image in WordPress RSS feed?

Include the below code snippet in your functions.php file:

function show_post_thumbnail_in_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = ‘<table><tr><td>’ . $content . ‘</td><td><img src=”‘ . get_the_post_thumbnail_url($post->ID, ‘gallery-2-thumb’) . ‘” width=”150px”></td></tr></table>’ ;
return $content;
add_filter(‘the_excerpt_rss’, ‘show_post_thumbnail_in_feeds’);
add_filter(‘the_content_feed’, ‘show_post_thumbnail_in_feeds’);

Code Customizations

In the above code snippet, a couple of things that you should customize based on your preferences are:

  • ‘gallery-2-thumb’ => Change the thumbnail to your preferred size. I have already talked about “how to add/update thumbnail sizes in your theme” in my previous post. Please refer to that, if needed.
  •  width=”150px” => Adding the width is not a necessity if your thumbnails are of the optimum size already, but if you want to customize it further for your RSS feed alone without the overhead of creating additional resized images, then you can do this.
  • HTML table => You can change the look and feel of the HTML table, if needed, based on your preferences. For example, changing the position/alignment of your thumbnail, adding captions etc.

But, wait. It’s not all!

Though from the coding perspective, the above should be enough, you will not be able to see the updates in your feed immediately (as it will not get refreshed before a new item is added to it i.e, you publish a new post).

But you do need to test it to make sure that the changes are looking fine. So, you have to refresh/regenerate your feed. Here’s how to do it for Feedburner.

How to force Feedburner to update your feed

This is how your feed will look once it is refreshed:


And that is all there is to add featured images to your RSS feeds.

Did you find this tip useful? How better to optimize it? Don’t forget to share your views in the comments section below.

PS: If you liked this WordPress Blogging 101 Tip, don’t forget to share it on your favorite social media platforms.


Vote For Me @ The Top Mommy Blogs Directory Vote For Me @ The Top Mommy Blogs Directory
Disclaimer: FertileBrains earns it's running costs through advertisements, affiliate links (rare) and sponsored third party content hosted here from time to time. Responsibility for the quality of such content rests with the sponsors/owners of that content and FertileBrains is not responsible for any errors or omissions in them. Again, any hyperlink from FertileBrains to another website does not automatically imply endorsement, support, or sponsorship of that website nor of the information and/or products provided. Such hyperlinks are included for additional reference/convenience only.

Leave A Comment