Wordpress does not add images to your RSS feed. There are plugins to do the job but here is an alternative by adding some lines of code to functions.php.

I accidentically stumbled upon this unexpected WordPress behaviour. Looking for a solution I came across this post Beitragsbilder im WordPress RSS-Feed einbinden by Tobias Rieder. He explained how to add a few lines of code to the functions.php file to add a post’s featured image to the RSS feed.

Of course, you could install a plugin like “Featured Images in RSS w/ Size and Position” to have the same result. But that would be yet another plugin. And every plugin uses some processing time on your server. Moreover, tinkering the functions.php is how real men do stuff like that. 😉 Add the following lines to your theme’s functions.php. It is advised to use a child theme for modifications like this.

function post_thumbnail_in_rss( $content ) {
  global $post;
  if ( has_post_thumbnail( $post->ID ) )
    $content = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => '' ) ) . $content;
  return $content;
}
add_filter( 'the_excerpt_rss',  'post_thumbnail_in_rss', 1000, 1 );
add_filter( 'the_content_feed', 'post_thumbnail_in_rss', 1000, 1 );

You can choose the picture’s size to be either full, medium, or thumbnail. Using style in the array you can inject CSS styles, e.g. add a margin or a border to your picture.

Have at it!

Leave a Reply

Your email address will not be published. Required fields are marked *