Hay, does anyone know a way to display the featured image url within the RSS feed?

function add_featured_image_url($output) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
        $output = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) . ' ' . $output;
    return $output;

add_filter('the_excerpt_rss', 'add_featured_image_url');
add_filter('the_content_feed', 'add_featured_image_url');
  • I've added this to my templates functions.php file, but when i read the feed i cannot see it. Do i need to do anything else to it? – dotty Sep 7 '10 at 14:31
  • Oh, a follow up. I'm using php's SimpleXmlElement() and reading the file through that. Will that make a difference? – dotty Sep 7 '10 at 14:39
  • ... nope reply. any ideas? – dotty Sep 9 '10 at 13:22
  • I missed you previous comments. There was an error in my answer, I edited it. – sorich87 Sep 9 '10 at 16:13
  • 1
    Sorich I think there's still an error, the code above will remove the post content and replace it with the url instead of adding it. Needs to be $output .= wp_get_att[...] instead of = – jerclarke Sep 11 '10 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.