Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Add featured images to your RSS feed

Show each post's featured image at the top of its RSS feed item, so feed readers and email newsletters include a picture.

  • Type PHP
  • Runs Everywhere
PHP
// Add the featured image to the top of each item in your RSS feeds.
function snipfire_rss_featured_image( $content ) {
	if ( has_post_thumbnail() ) {
		$content = '<p>' . get_the_post_thumbnail( null, 'large' ) . '</p>' . $content;
	}
	return $content;
}
add_filter( 'the_excerpt_rss', 'snipfire_rss_featured_image' );
add_filter( 'the_content_feed', 'snipfire_rss_featured_image' );

What it does

WordPress RSS feeds include the text of each post but not its featured image. Feed readers and RSS-to-email newsletter tools then show plain text.

This snippet adds the featured image, in the "large" size, to the top of each item in both the summary and the full-text feed.

Good to know

  • Feed readers cache feeds, so it can take a few hours for images to appear.
  • Change 'large' to 'medium' for smaller images.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.