Skip to content

Instantly share code, notes, and snippets.

@justinstern
Last active July 22, 2016 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinstern/0d9bc89c5c9c52799b2c to your computer and use it in GitHub Desktop.
Save justinstern/0d9bc89c5c9c52799b2c to your computer and use it in GitHub Desktop.
Include featured images in WordPress RSS feed post entries
// add everything below this point to the bottom of your current theme's functions.php
function prepend_thumbnail_rss( $content ) {
global $post;
if ( has_post_thumbnail( $post->ID ) ) {
$content = get_the_post_thumbnail( $post->ID, 'full' ) . $content;
}
return $content;
}
add_filter( 'the_excerpt_rss', 'prepend_thumbnail_rss' );
add_filter( 'the_content_feed', 'prepend_thumbnail_rss' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment