Title: Problem with RSS thumbnail code
Last modified: August 20, 2016

---

# Problem with RSS thumbnail code

 *  Resolved [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/)
 * I have tried the different codes there are out there to include a thumbnail in
   the RSS feed and they do insert the thumbnail in the feed but when I view a post
   with a thumbnail attached to it on my website, the post excerpt is showing up
   on the top of the page before the wrapper.
    Does anyone know why this is? Thanks
   Erik
 * // THIS INCLUDES THE THUMBNAIL IN OUR RSS FEED
    add_filter( ‘the_excerpt_rss’,‘
   voodoo_insertThumbnailRSS’ ); add_filter( ‘the_content_feed’, ‘voodoo_insertThumbnailRSS’);
   function voodoo_insertThumbnailRSS( $content ) {
 *  global $post;
 *  if ( has_post_thumbnail( $post->ID ) )
    $content = ” . get_the_post_thumbnail(
   $post->ID ) . ” . $content;
 *  return $content;
    }

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/page/2/?output_format=md)

 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293501)
 * I’m not 100% sure as I’ve never had any issues with that code on any site.
 * I wonder if your theme is using the_excerpt_rss for some reason?
 * What theme are you using? Also, if you switch to twentyeleven for a moment just
   to test, does the problem go away?
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293518)
 * I am using the magazine style Mimbo theme.
 * When I switch to twenty eleven yes the problem goes away.
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293521)
 * I just found out that there is a line of code in the header which includes ‘the_excerpt_rss’
 * [http://pastebin.com/67T2y75z](http://pastebin.com/67T2y75z)
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293522)
 * That’s not related. It’s trying to output a meta description for your site’s 
   pages and won’t impact on your RSS feed.
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293523)
 * Hmmm….
 * I think that if an image is filtered onto the_excerpt_rss, and added into that
   meta description through that, it may jack things up…
 * you have a link to see your source code?
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293526)
 * However it displays the excerpt on top of the page when viewing post with an 
   thumbnail attached to it.
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293528)
 * Yes its [http://www.matvarupriser.se](http://www.matvarupriser.se)
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293530)
 * Tsk! Bad Voodoo 😉 Just realised you’re altering `the_excerpt_rss` – which is
   fine if your theme doesn’t use it anywhere **but** the RSS feed. However, in 
   theory, this should just bork the meta description – not the feed, yes?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293532)
 * Just a hunch but, in the code you posted above, try changing:
 * `<meta name="description" content="<?php the_excerpt_rss(); ?>" />`
 * to:
 * `<meta name="description" content="<?php strip_tags( the_excerpt_rss() ); ?>"/
   >`
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293535)
 * Yup, it’s definitely conflicting….
 *     ```
       <meta name="description" content="<img width="600" height="472" src="http://matvarupriser.se/nyhetsrum/wp-content/uploads/2011/09/Annelieframtidensmat.jpg?e2686d" class="attachment-post-thumbnail wp-post-image" alt="Annelieframtidensmat" title="Annelieframtidensmat" />Annelie Hellström, VD för FramtidensMat, i krönikan: Gåvan att få bidra till ett enklare liv med goda middagar!
       " />
       ```
   
 * Is what is getting output to your head….
 * I’m not totally sure how to go about fixing it, I’ve never used the_excerpt_rss
   within a theme…. I don’t think swapping that out for the_excerpt will work, I
   think that would bring in other stuff….
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293538)
 * So would this code be the best solution for this
 * <meta name=”description” content=”<?php strip_tags( the_excerpt_rss() ); ?>” /
   >
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293539)
 * [@esmi](https://wordpress.org/support/users/esmi/) just saw your post. I believe
   that it only did bork the theme, not the feed.
 * Is there a better way to get where I’m going? Images in the rss feeds? If so,
   I’m all ears!! er… eyes!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293540)
 * **[@erikhgm](https://wordpress.org/support/users/erikhgm/)**: It should work.
   At worst, it won’t help but it shouldn’t break anything else.
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293542)
 * I just tried changing the code but its the excerpt still shows up.
 * Could I just remove the line?
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/#post-2293544)
 * technically
 *     ```
       <?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       <meta name="description" content="<?php the_excerpt_rss(); ?>" />
       <?php endwhile; endif; elseif(is_home()) : ?>
       <meta name="description" content="<?php bloginfo('description'); ?>" />
       <?php endif; ?>
       ```
   
 * Could be removed entirely…. that just sets up meta description
 * An SEO plugin (such as Yoasts WordPress SEO) could add in the descriptions if
   you want them, probably more effectively
 * It’s up to what you wish to do
 * Also, if there is a way to improve my code up above for putting images into the
   rss feed, I’d love to see that to.

Viewing 15 replies - 1 through 15 (of 19 total)

1 [2](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/page/2/?output_format=md)

The topic ‘Problem with RSS thumbnail code’ is closed to new replies.

## Tags

 * [excerpt](https://wordpress.org/support/topic-tag/excerpt/)
 * [RSS](https://wordpress.org/support/topic-tag/rss/)

 * 19 replies
 * 3 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/problem-with-rss-thumbnail-code/page/2/#post-2293645)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
