{"id":1599,"date":"2013-10-06T19:00:33","date_gmt":"2013-10-07T02:00:33","guid":{"rendered":"http:\/\/www.virendrachandak.com\/techtalk\/\/?p=1599"},"modified":"2016-03-25T18:03:11","modified_gmt":"2016-03-26T01:03:11","slug":"wordpress-add-featured-image-rss-feed","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/","title":{"rendered":"How to add featured image to WordPress RSS feed"},"content":{"rendered":"<p>Recently I came across a situation when I wanted to add the featured image of the posts to my RSS Feed. By default WordPress does not shows the Featured Image in the RSS Feed. This can be easily achieved by adding a few lines of code in the functions.php file of the theme.<\/p>\n<p><strong>Important<\/strong>: Make sure to add the code to the functions.php file of your theme. Do not add it to the functions.php file in the wp-includes directory.<br \/>\n<!--more--><\/p>\n<p>Here is the code that will add the featured image before the content with a margin-bottom of 10px.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/Function to add featured image in RSS feeds\r\nfunction featured_image_in_rss($content)\r\n{\r\n\t\/\/ Global $post variable\r\n\tglobal $post;\r\n\t\/\/ Check if the post has a featured image\r\n\tif (has_post_thumbnail($post-&gt;ID))\r\n\t{\r\n\t\t$content = get_the_post_thumbnail($post-&gt;ID, 'full', array('style' =&gt; 'margin-bottom:10px;')) . $content;\r\n\t}\r\n    return $content;\r\n}\r\n\/\/Add the filter for RSS feeds Excerpt\r\nadd_filter('the_excerpt_rss', 'featured_image_in_rss');\r\n\/\/Add the filter for RSS feed content\r\nadd_filter('the_content_feed', 'featured_image_in_rss');\r\n<\/pre>\n<p>If you want to use different size of image just change the &#8216;full&#8217; in above code (line 9) to the correct image size name e.g. thumb<\/p>\n<pre class=\"brush: php; gutter: false; title: ; notranslate\" title=\"\">\r\n\t$content = get_the_post_thumbnail($post-&gt;ID, 'thumb', array('style' =&gt; 'margin-bottom:10px;')) . $content;\r\n<\/pre>\n<p>To add a custom sized image you can pass the size of to the get_the_post_thumbnail function. e.g. for a image of size 300&#215;169 use the following code:<\/p>\n<pre class=\"brush: php; gutter: false; title: ; notranslate\" title=\"\">\r\n\t$content = get_the_post_thumbnail($post-&gt;ID, array(300, 169), array('style' =&gt; 'margin-bottom:10px;')) . $content;\r\n<\/pre>\n<p>If you would like the featured image to be shown below the content, just change the line 9 to<\/p>\n<pre class=\"brush: php; gutter: false; title: ; notranslate\" title=\"\">\r\n\t$content = $content. get_the_post_thumbnail($post-&gt;ID, 'full', array('style' =&gt; 'margin-bottom:10px;'));\r\n<\/pre>\n<p>You can add custom code surrounding the image too. e.g. the following code will add the full-sized featured image within a div with class featured_image_post_rss. <\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/Function to add featured image in RSS feeds\r\nfunction featured_image_in_rss($content)\r\n{\r\n\t\/\/ Global $post variable\r\n\tglobal $post;\r\n\t\/\/ Check if the post has a featured image\r\n\tif (has_post_thumbnail($post-&gt;ID))\r\n\t{\r\n\t\t$content = '&lt;div class=&quot;featured_image_post_rss&quot;&gt;' . get_the_post_thumbnail($post-&gt;ID, 'full') . '&lt;\/div&gt;' . $content;\r\n\t}\r\n    return $content;\r\n}\r\n\/\/Add the filter for RSS feeds Excerpt\r\nadd_filter('the_excerpt_rss', 'featured_image_in_rss');\r\n\/\/Add the filter for RSS feed content\r\nadd_filter('the_content_feed', 'featured_image_in_rss');\r\n<\/pre>\n<div style=\"padding-top:15px;\">\n<strong>Reference Links<\/strong>:<\/p>\n<ul>\n<li><a title=\"Function Reference\/has post thumbnail\" href=\"http:\/\/codex.wordpress.org\/Function_Reference\/has_post_thumbnail\" rel=\"external nofollow\" target=\"_blank\">WordPress Function Reference\/has post thumbnail<\/a><\/li>\n<li><a title=\"Function Reference\/get the post thumbnail\" href=\"http:\/\/codex.wordpress.org\/Function_Reference\/get_the_post_thumbnail\" rel=\"external nofollow\" target=\"_blank\">WordPress Function Reference\/get the post thumbnail<\/a><\/li>\n<li><a title=\"Plugin API\/Filter Reference\/the content rss\" href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Filter_Reference\/the_content_rss\" rel=\"external nofollow\" target=\"_blank\">WordPress Plugin API\/Filter Reference\/the content rss<\/a><\/li>\n<li><a title=\"Plugin API\/Filter Reference\/the content feed\" href=\"http:\/\/codex.wordpress.org\/Plugin_API\/Filter_Reference\/the_content_feed\" rel=\"external nofollow\" target=\"_blank\">WordPress Plugin API\/Filter Reference\/the content feed<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recently I came across a situation when I wanted to add the featured image of the posts to my RSS Feed. By default WordPress does not shows the Featured Image in the RSS Feed. This can be easily achieved by adding a few lines of code in the functions.php file of the theme. Important: Make [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[91],"tags":[133,123,124,122],"class_list":["post-1599","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-feed","tag-rss","tag-snippets","tag-wordpress-feed"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to add featured image to WordPress RSS feed - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"WordPress by default does not adds Featured Image to RSS Feeds. We can add the Featured Image to RSS Feeds by using these simple steps without any plugins.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to add featured image to WordPress RSS feed - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"WordPress by default does not adds Featured Image to RSS Feeds. We can add the Featured Image to RSS Feeds by using these simple steps without any plugins.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2013-10-07T02:00:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-26T01:03:11+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"How to add featured image to WordPress RSS feed\",\"datePublished\":\"2013-10-07T02:00:33+00:00\",\"dateModified\":\"2016-03-26T01:03:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\"},\"wordCount\":489,\"commentCount\":18,\"publisher\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"Feed\",\"RSS\",\"snippets\",\"Wordpress Feed\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\",\"url\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\",\"name\":\"How to add featured image to WordPress RSS feed - Virendra&#039;s TechTalk\",\"isPartOf\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#website\"},\"datePublished\":\"2013-10-07T02:00:33+00:00\",\"dateModified\":\"2016-03-26T01:03:11+00:00\",\"description\":\"WordPress by default does not adds Featured Image to RSS Feeds. We can add the Featured Image to RSS Feeds by using these simple steps without any plugins.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\/\/www.virendrachandak.com\/techtalk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress\",\"item\":\"https:\/\/www.virendrachandak.com\/techtalk\/category\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to add featured image to WordPress RSS feed\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#website\",\"url\":\"https:\/\/www.virendrachandak.com\/techtalk\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.virendrachandak.com\",\"https:\/\/www.facebook.com\/virendrachandak\",\"https:\/\/www.linkedin.com\/in\/virendrachandak\/\",\"https:\/\/x.com\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to add featured image to WordPress RSS feed - Virendra&#039;s TechTalk","description":"WordPress by default does not adds Featured Image to RSS Feeds. We can add the Featured Image to RSS Feeds by using these simple steps without any plugins.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/","og_locale":"en_US","og_type":"article","og_title":"How to add featured image to WordPress RSS feed - Virendra&#039;s TechTalk","og_description":"WordPress by default does not adds Featured Image to RSS Feeds. We can add the Featured Image to RSS Feeds by using these simple steps without any plugins.","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2013-10-07T02:00:33+00:00","article_modified_time":"2016-03-26T01:03:11+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"How to add featured image to WordPress RSS feed","datePublished":"2013-10-07T02:00:33+00:00","dateModified":"2016-03-26T01:03:11+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/"},"wordCount":489,"commentCount":18,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["Feed","RSS","snippets","Wordpress Feed"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/","name":"How to add featured image to WordPress RSS feed - Virendra&#039;s TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2013-10-07T02:00:33+00:00","dateModified":"2016-03-26T01:03:11+00:00","description":"WordPress by default does not adds Featured Image to RSS Feeds. We can add the Featured Image to RSS Feeds by using these simple steps without any plugins.","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/wordpress-add-featured-image-rss-feed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"WordPress","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/wordpress\/"},{"@type":"ListItem","position":3,"name":"How to add featured image to WordPress RSS feed"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-pN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=1599"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/1599\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}