Do you want to display your post thumbnails in your WordPress RSS feeds?
RSS Feeds are used to promote website content in feed readers, directories, and other RSS Feeds powered applications.
By default, WordPress doesn’t include post thumbnails in the RSS feeds. You need to add it explicitly using the below code.
/**
* Add Post Thumbnails to RSS Feeds
*
* @param string[] $content
* @return string[] $content
*/
function maverick_add_post_thumbnail_to_rss_feed($content)
{
global $post;
if (has_post_thumbnail($post->ID)) {
$content = '' . get_the_post_thumbnail($post->ID) . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'maverick_add_post_thumbnail_to_rss_feed');
add_filter('the_content_feed', 'maverick_add_post_thumbnail_to_rss_feed');