Add post thumbnails to RSS feed

Add post thumbnails to RSS feed

This very cool piece of code will get the post thumbnail and automatically add it to your RSS feeds. Paste the code into functions.php and save the file. Don’t forget that you need to use a theme that supports post thumbnails for this snippet to work.

    function cwc\_rss\_post_thumbnail($content) {
        
    global $post;
        
    if(has\_post\_thumbnail($post->ID)) {
            
    $content = ‘

    ‘ . get\_the\_post_thumbnail($post->ID) .
            
    ‘

    ‘ . get\_the\_content();
        
    }

    return $content;
    
    }
    
    add\_filter(‘the\_excerpt\_rss’, ‘cwc\_rss\_post\_thumbnail’);
    
    add\_filter(‘the\_content\_feed’, ‘cwc\_rss\_post\_thumbnail’);