Add featured image to RSS feed through child theme functions.php file

You may need to clear your Feeds cache to see the image after adding this code.

function wpsitesdotnet_post_thumbnail_rss($content) {

global $post;

if ( has_post_thumbnail( $post->ID ) ){

$content="" . get_the_post_thumbnail( $post->ID, 'rss-image', array( 'class' =>   

'aligncenter' ) );  

}

return $content;

}

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

Source http://wpsites.net/web-design/add-featured-image-thumbnail-from-post-to-rss-feed/

Leave a Comment