How to add featured images to your WordPress RSS Feed

label_outlinechat_bubble_outline Comment

Have you ever wanted to add featured images to your WordPress RSS feed? Many times your RSS feed will only show images that you’ve put into the post, but it won’t show featured images. There’s a quick and easy fix that will remedy this problem.

Add the below code to your functions.php file within your theme folder:

// INCLUDES IMAGES IN THE RSS FEED
function insertThumbnailRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '' . $content;
}
return $content;
}

add_filter('the_excerpt_rss', 'insertThumbnailRSS');
add_filter('the_content_feed', 'insertThumbnailRSS');

If you’d like to change the size of the thumbnails simply replace the word “thumbnail” in ( $post->ID, ‘thumbnail’ ) with either “medium”, “large” or “full”.

Now refresh your blog url and see the results. We hoped you liked this tutorial on adding featured images to your WordPress RSS Feed.

From all of us at WireFlare we ask that you help others find the answers they are looking for. Please leave a comment or share this post!

About

Blog Bio Picture For Todd

I'm the President of WireFlare. I have a passion for creativity, online business and internet security. I strive to create a community that empowers people to be themselves. I'm an adventurist, fun loving and caring. Find me hiking in places most people don't dare to go!

Get a free consultation today!