How to Add Post Thumbnail to RSS Feed in WordPress

How to Add Post Thumbnail to RSS Feed in WordPress

In this tutorial, I will show you how to add post thumbnail to rss feed in WordPress using very simple few line of code without using any plugin. This code working fine for add WordPress featured image RSS feed address. This will take just few minute.

First we need to add some code to your website. Open your website theme function.php file and put below code into function.php file and save.

function featuredtoRSS($content)
 {
     global $post;
     if ( has_post_thumbnail( $post->ID ) ){
         $content = '
' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'style' => 'margin-bottom: 15px;' ) ) . '
' . $content;
     }
     return $content;
 }
 add_filter('the_excerpt_rss', 'featuredtoRSS');
 add_filter('the_content_feed', 'featuredtoRSS');

In get_the_post_thumbnail() function you can also use medium and large instant of thumbnail. according to your requirement of image size. for example:
$content = get_the_post_thumbnail( $post->ID, ‘large’)

Tags:
adding images to rss feed, wordpress import rss feed with featured image, wordpress rss feed plugin with image, rss feed with images example, wordpress rss feed image missing, rss feed to post wordpress plugin, wordpress rss image tag, wordpress rss thumbnail image

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts: You may like

How to track contact form 7 form in salesforce without plugin

Contact Form 7 Redirect to Thank You Page

How to Validation Business Email in Contact Form 7 WordPress

How to Create and get WordPress Custom Field

How to add post from frontend in wordpress without plugin

WordPress Websites Are SEO Friendly Or Not

How to get last insert id in WordPress

How to Change WordPress Email From Sender Name Email Settings Without Plugin

How to Create Custom Shortcodes in WordPress

how to fetch custom post by tags in WordPress

PHPKIDA Offering Free Tools:

INSTA DOWNLOADER

Free online tool to download Instagram videos, photos and save Instagram videos, photos to your device. It's free & easy to use.

Download Now

CURRENCY CONVERTER

Our real time currency converter calculator will convert your money based on current values from around the world. It's free & easy to use.

Convert Now

ROBOST.TXT GEN.

Create robots txt file that help search engines to crawling and indexing your site with help of our free online Robots.txt Generator tool.

Create Now

HTML MINIFIER

Free online tool to minify or compress html code and reduce the size of html code in few clicks. It's free & easy to use.

Minify Now

CSS MINIFIER

Free online tool to minify or compress css code and reduce the size of css code in few clicks. It's free & easy to use.

Minify Now

JAVASCRIPT MINIFIER

Free online tool to minify or compress javascript code and reduce the size of javascript code in few clicks. It's free & easy to use.

Minify Now

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.