Categories

Friday, December 27, 2024
#919814419350 therichposts@gmail.com
Wordpress HooksWordpress Tricks

How to Add Featured Image to WordPress RSS Feed?

How to add custom meta title and meta description in Wordpress?

Add Featured Image to WordPress RSS Feed

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

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

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