Add Post Thumbnail to WordPress RSS Feed

  • follow us in feedly
Published March 8, 2013 by Brad Knutson
WordPress Post Thumbnails Feed

My last post about how to add custom post types to a WordPress RSS feed briefly explained the shortcomings of WordPress’ built in RSS feed generator on a fresh install. It leaves a lot to be desired.

Let’s say that your blog section displays post thumbnails, much like mine does. Out of the box, WordPress will not display your post thumbnails in your RSS feed. It also writes the entire post out (without stylesheets) rather than just the post excerpt.

In my opinion, these two shortcomings are aspects of your feed that can be improved. Below is a function that will do just that. Add this function to your theme’s functions.php file.

function rss_post_thumbnail($content) {
	global $post;
	if(has_post_thumbnail($post->ID)) {
		$content = '<div>' . get_the_post_thumbnail($post->ID) .
		'</div>' . get_the_excerpt();
	return $content;
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

This will modify your RSS feed to have post thumbnails (at their original size), followed by the excerpt of the post. You can use inline styles to modify the look of your feed. Perhaps you want to float the post thumbnail to the left of the text. You can accomplish this by adding inline style to the div container of the thumbnail.

Another quick modification is the use of get_the_excerpt() as opposed to get_the_content(). If you are giving your readers the full post in your feed, what would give them the incentive to click through to the full article? The excerpt gives your reader a quick teaser and the combination of the shortened post, the thumbnail (and potentially a read more link) give your reader more incentive to click through to your site.

The following two tabs change content below.
Founder at Inbounderish
Brad Knutson is a Web Developer in the Twin Cities area of Minnesota. He has experience working with WordPress and Drupal, and also has an interest in SEO and Inbound Marketing.

Keep Up-to-Date



See a complete list of topics discussed in blog posts here.

Check These Out

Get 2 Weeks Free! Sign Up Today! Premium Managed WordPress Hosting Genesis Framework for WordPress SEO is complex. Tools should be simple. Thesis Theme for WordPress:  Options Galore and a Helpful Support Community

One thought on “Add Post Thumbnail to WordPress RSS Feed

Share Your Thoughts

Your email address will not be shown.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">