Home > Dev > WordPress SEO > RSS Feed Enhancements

RSS Feed Enhancements

This code adds post thumbnails to RSS feeds.

// Add this to your theme's functions.php file

function add_thumbnails_to_rss($content) {
    global $post;
    if (has_post_thumbnail($post->ID)) {
        $content = '<p>' . get_the_post_thumbnail($post->ID, 'medium') . '</p>' . $content;
    }
    return $content;
}
add_filter('the_excerpt_rss', 'add_thumbnails_to_rss');
add_filter('the_content_feed', 'add_thumbnails_to_rss');
Back