I want to add the featured image to my RSS feed.
function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) . '</p>' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail', 20, 1);
add_filter('the_content_feed', 'rss_post_thumbnail', 20, 1);
With this snippet the thumbnail is shown, but the content is not generated correct. It is shown with shortcodes and its not formatted...
When i use the snippet below, where i remove the ordering of filters, the content is shown, but the featured image is missing:
function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) . '</p>' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');