Displaying WordPress Article Images in the Feed As Well

<?php function ah_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', 'ah_rss_post_thumbnail'); add_filter('the_content_feed', 'ah_rss_post_thumbnail');
If you’re using the standard WordPress feeds, you might have noticed already that the article images don’t show up in the feed.

1 Response

Does it make more sense in this case to use the filtered `$content` instead of `get_the_content()`? I feel like as is you are overriding any previous filters.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.