CMS Scripts

How to Add Images to WordPress Feed

Add Images to WordPress Feed

Add Images to WordPress Feed. WordPress still does not offer the functionality to display the image of a post in the RSS feed. With this feature you can add images in your feed by adding this function to the functions.php template. Add Images to WordPress feed

File to edit: functions.php

PHP

1
2
3
4
5
6
7
8
9
function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = get_the_post_thumbnail($post->ID) . $content;
}
return $content;
}
add_filter(‘the_excerpt_rss’, ‘rss_post_thumbnail’);
add_filter(‘the_content_feed’, ‘rss_post_thumbnail’);

Leave a Reply