Wordpress HooksWordpress Tricks

How to Add Featured Image to WordPress RSS Feed?

Add Featured Image to WordPress RSS Feed

wordpress cheat code to update User Password mysql query
353Views

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

Ajay Malhotra
the authorAjay Malhotra
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am full stack developer. I love coding. I know Wordpress, Core php, Angularjs, Angular 2, Angular 6, Angular 7, laravel, Codeigniter, Shopify, Squarespace, Jquery, Google Map Api, Vuejs, Reactjs, Bigcommerce etc.

Leave a Reply

Positive SSL