WP-Mix

A fresh mix of code snippets and tutorials

Add featured images to WordPress feeds

By default, WordPress does not display your post’s featured images in feeds. Fortunately it’s easy to do.

Just add the following snippet to your theme’s functions.php file:

function rss_post_thumbnail($content) {
	global $post;
	if(has_post_thumbnail($post->ID)) {
		$content = get_the_post_thumbnail($post->ID) . $content;
	}
	return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

Note that you may need to empty your browser cache to load a fresh copy of your feed.

Learn more

Digging Into WordPressWordPress Themes In DepthWizard’s SQL Recipes for WordPress