Add Featured Image to WordPress RSS Feed

In our earlier tutorial, we have shown you how to add featured image or thumbnail to WordPress post. But the featured image would not be automatically displayed in the RSS feed. A filter need to be added to display featured image in RSS feed. In this article, we’ll provide the simple way to add featured image to WordPress RSS feed. Using add_filter() with a simple function, you can easily include post thumbnail in RSS feeds.

Open the theme’s function.php file and add the following code in this file.

// display featured post thumbnails in WordPress rss feeds
function add_post_thumbnail_in_rss_feeds($content){
$content '<p>' get_the_post_thumbnail($post->ID) . '</p>' get_the_content();

Post Thumbnail Size

You can display your desire size of the featured image by using the second parameter of get_the_post_thumbnail() function. Specify the post thumbnail width and height as an array.

get_the_post_thumbnail($post->ID, array(650,350))

Related Articles

Comments 0