Home Wordpress Hooks How to Add Featured Image to WordPress RSS Feed?

How to Add Featured Image to WordPress RSS Feed?

by therichpost
0 comments
How to add custom meta title and meta description in Wordpress?

Hello, welcome to therichpost.com. In this post, How to Add Featured Image to WordPress RSS Feed?WordPress is the best cms. I personally like it very much and my mostly posts are related to wordpress.

We will How to Add Featured Image to WordPress RSS Feed with wordpress add filter hook and here is the working code and you need to add this into your theme’s functions.php file:
// display featured post thumbnails in WordPress rss feeds

function add_post_thumbnail_in_rss_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', 'add_post_thumbnail_in_rss_feeds');
add_filter('the_content_feed', 'add_post_thumbnail_in_rss_feeds');

If you have any query related to this then   please do comment. Thank you. therichpost.com

You may also like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.