Display Featured Post Thumbnails In WordPress Feeds

[ad_1]

WordPress does not allow featured post thumbnails in feeds even if you enable the post thumbnails support. But we have a solution for that. Here is how you can add post thumbnails to your WordPress RSS feeds with a simple function.

Just copy and paste this code snippet in your theme functions.php file and your RSS feeds will display featured post thumbnails along with content.

// display featured post thumbnails in WordPress feeds
function wcs_post_thumbnails_in_feeds( $content ) {
    global $post;
    if( has_post_thumbnail( $post->ID ) ) {
        $content="<p>" . get_the_post_thumbnail( $post->ID ) . '</p>' . get_the_content();
    }
    return $content;
}
add_filter( 'the_excerpt_rss', 'wcs_post_thumbnails_in_feeds' );
add_filter( 'the_content_feed', 'wcs_post_thumbnails_in_feeds' );
[ad_2]

Leave a Reply

Random Post Selection ::

Recent Posts

Unlock Unlimited Downloads