Skip to content

Add Featured Image Thumbnail to RSS Feed

If your theme in WordPress utilizes the Featured image, also known as Thumbnail image in WordPress, your RSS feed most likely wont automatically include this. To change this, there is a simple theme function hack for this. I would highly suggest though, if you’re playing with theme files, to create a child theme for your website (instructions here), and then add the following code to your child themes functions.php file:

function insertThumbnailRSS($content) {
global $post;
$content = ‘<p>’ . get_the_post_thumbnail( $post->ID, array( 500, 500)) . ‘</p>’ . $content;
return $content;
add_filter(‘the_excerpt_rss’, ‘insertThumbnailRSS’);
add_filter(‘the_content_feed’, ‘insertThumbnailRSS’);

Here you will see that I have chosen to insert the post thumbnail at the size 500px x 500px. You can read up a bit more on the different sizes of post thumbnails in WordPress here. Testing this will show that it chooses the longest edge of the thumbnail image to resize according to these dimensions, which means your images aren’t distorted.

Thanks to WP Insight for this tip on how to add the WordPress Thumbnail into the RSS feed.

1 thought on “Add Featured Image Thumbnail to RSS Feed”

  1. Pingback: Complete Setup of Wordpress RSS with Mailchimp « Css « Teition Solutions

Leave a Reply

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

4 × 2 =