Add Post Thumbnails to WordPress RSS Feed

Add Post Thumbnails to WordPress RSS Feed

Did you know that if you implement post thumbnails in your theme, they will not be automatically included in your RSS?

You need to add a little function to get them to show up in your feed. It’s not difficult. Just copy and paste this into your functions.php file.

function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '

' . get_the_post_thumbnail($post->ID) .
'

' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

Source: David Redfern’s Post a Week

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

Tags: