How to add the Featured Image to WordPress RSS Feed

Problem:

By default, WordPress does not include the featured image in the RSS feed of your posts.

Solution:

Add this snippet of code to your functions.php or a mu-plugin. The below code uses the ‘large’ format image of the file saved as the featured image for the post.

function featuredIMGtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'large', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}
 
add_filter('the_excerpt_rss', 'featuredIMGtoRSS');
add_filter('the_content_feed', 'featuredIMGtoRSS');

How To: PHP to Display Current Year

An alternative method to using jQuery to display the current year would be to get the date server side with a language like PHP. If your web hosting can run PHP you can deploy the following PHP code to display the current year.

<?php echo date('Y'); ?>

Printing the current year on the page with a PHP script is commonly used to display a copyright year in the footer.

Current year isn’t the only format the PHP date() can display. Visit the date function page on php.net to see the other formatting parameters.