/**
* Add the post thumbnail, if available, before the content in feeds.
*
* @param string $content The post content.
*
* @return string Modified content with post thumbnail.
*/
function wpcode_snippet_rss_post_thumbnail( $content ) {
global $post;

// Ensure $post is set and has a thumbnail
if ( isset( $post ) && has_post_thumbnail( $post->ID ) ) {
// Use ‘medium’ image size
$content = ‘

‘ . wp_kses_post( get_the_post_thumbnail( $post->ID, ‘medium’ ) ) . ‘

‘ . $content;
}

return $content;
}

add_filter( ‘the_excerpt_rss’, ‘wpcode_snippet_rss_post_thumbnail’ );
add_filter( ‘the_content_feed’, ‘wpcode_snippet_rss_post_thumbnail’ );