Last active
September 27, 2022 07:24
-
-
Save Sam-Jenkins/65734973dc6dab876c0e7ac1d26d8af1 to your computer and use it in GitHub Desktop.
Wordpress - Featured Image In RSS Feed
This file contains hidden or 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
<?php | |
function addRssFeaturedImage() { | |
global $post; | |
if (has_post_thumbnail($post->ID)) { | |
echo '<featured_image>' . wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'featured_size' )[0] . '</featured_image>'; | |
} | |
} | |
add_action('rss2_item', 'addRssFeaturedImage'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment