Created
July 3, 2017 10:20
-
-
Save roscabgdn/c30fc808d18d6eaec38417e51c6c85dc to your computer and use it in GitHub Desktop.
Add post featured image as rss node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add the image node to RSS feed | |
add_action('rss2_item', 'add_featured_image_as_rss_node'); | |
function add_featured_image_as_rss_node() { | |
global $post; | |
if(has_post_thumbnail($post->ID)): | |
$thumbnail = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); | |
echo("<image>{$thumbnail}</image>"); | |
endif; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment