Add Post Thumbnail to RSS Feed in WordPress in Very Easy Steps to Make Your Feed and FeedBurner Delivered Newsletters More Interesting. We have lot of articles on troubleshooting WordPress RSS Feed and Feedburner – if you face any issue in future, you can search them by manually searching on our website. Actually for Facebook, Twitter; the media files are directly grabbed from the Open Graph Protocol, RSS remained like it was 10 years ago. Also, we have supplied a free plugin to Add Post Thumbnail to RSS Feed in WordPress in this article, however we do not recommend to use it; instead use manual code for troubleshooting.
Add Post Thumbnail to RSS Feed in WordPress : How the Basic Logic Works
Here is the specification of RSS feed :
1 | http://validator.w3.org/feed/docs/rss2.html |
If you do not add proper markup, obviously your RSS feed will fail to pass validation. More specifically :
---
1 | http://validator.w3.org/feed/docs/rss2.html#ltimagegtSubelementOfLtchannelgt |
So, you can add more markups. This is the file which generates RSS :
1 | https://thecustomizewindows.com/wp-rss2.php |
Actually we were fixing an issue (automatically added “This articlet post name published first on The Customize Windows by Abhishek Ghosh. “) Later discovered that it was added by WP SEO. There was a request to write a guide on how to ddd Post Thumbnail in RSS Feed, so we looked a bit deeper on the topic. You need to add this snippet on your active Theme’s / Child Theme’s functions.php
file :
1 2 3 4 5 6 7 8 9 | function your_post_thumbnail_feeds($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = $content . '<div><a href="' . the_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID) . '</a></div> ' . $content; } return $content; } add_filter('the_excerpt_rss', 'your_post_thumbnail_feeds'); add_filter('the_content_feed', 'your_post_thumbnail_feeds'); |
It will give you thumbnail on RSS plus the thumbnail will link back to the post. Please troubleshoot validation checking the standard. We have added / used div as none is using an uniform WordPress theme.
your
is a just name; you can change to something of your choice. Well, here is lot of discussion on the topic :
1 | http://wordpress.org/support/topic/thumbnailsfeatured-images-in-rss-feed-in-30 |
There was a plugin before in WordPress repo :
1 | http://plugins.svn.wordpress.org/thumbnail-for-excerpts/tags/2.1/thumbnailforexcerpts.php |
But probably it is not required by the most plus most keep magic quotes to off (its about PHP.ini file). We added a simple Plugin :
1 | https://github.com/AbhishekGhosh/WordPress-RSS-Thumbnail/ |