WordPress.org

Support

Support » How-To and Troubleshooting » RSS error: Extra content at the end of the document

RSS error: Extra content at the end of the document

  • Adriaandejongh

    @adriaandejongh

    Hello!

    My RSS feed won’t stop giving errors. Right now, it’s says “Extra content at the end of the document” and I don’t understand where it’s coming from.

    http://gameovenstudios.com/feed/

    An RSS Validator shows that the RSS feed also includes the entire HTML page of my website, which shouldn’t be the case I guess?

    Anyone has an idea on how to fix it?

    -Adriaan

Viewing 15 replies - 1 through 15 (of 21 total)
  • I’ve seen some plugins added extra content at the end of a feed. Have you tried deactivating your plugins (assuming you’re using any) and switching to a default theme like twentytwelve or twentythirteen?

    Adriaandejongh

    @adriaandejongh

    Even with the default theme ( on http://gameovenstudios.com/wordpress/ and http://gameovenstudios.com/wordpress/feed/ ) it still prints the entire page at the bottom of the feed… What should normally stop the page from running? The .htaccess file maybe?

    Adriaandejongh

    @adriaandejongh

    The question is, I guess, how can I stop the HTLM code from printing after parsing the RSS feed?

    Have you tried deactivating all your plugins? I’ve typically seen this happen with plugins that don’t take into account for non-html output (like an XML/RSS or JSON feeds).

    Adriaandejongh

    @adriaandejongh

    The only plugin I use is Disqus for comments, and deactivating it helps nothing.

    Something I should mention: I integrated the loop into my own website. Could that be the cause of all troubles? Is there something that theme’s do that I should be doing as well?

    Is your website the one the feed is attached to? (Not sure I’m following you here…)

    Are you using a filter on the_content anywhere?

    And anyway you could comment out the loop in your website to test?

    Adriaandejongh

    @adriaandejongh

    At the bottom of the RSS feed, my entire website also gets printed, yes. Not using filters. Commenting out my loop also doesn’t solve the problem.

    Any other suggestions?

    Strange, I’ll have to think on it. I looked through the feed.php in core to see what it was doing, but the only possible I think I could think of on first glance was something to do with the_content.

    Adriaandejongh

    @adriaandejongh

    Question: what should stop the execution of the rest of the page when it IS working?

    esmi

    @esmi

    Forum Moderator

    Try checking your site’s error logs for messages. Your hosts should be able to help you accessing your site’s error logs.

    Adriaandejongh

    @adriaandejongh

    Where should I look for when I want to find my site’s error logs? (Like, do the logs have a specific name?)

    esmi

    @esmi

    Forum Moderator

    Usually they’re literally called error.log but this could vary from host to host. You need to ask your hosts for assistance with accessing yours.

    The error log may or may not be of help depending on what the issue is.

    How comfortable are you editing files?

    It looks like in a default configuration, your feed is coming from

    wp-includes/feed-rss2.php

    You might be able to edit that and see if you get any changes or where the extra html is coming from. One caveat, you’ll need to disable Magpie cache on the RSS feed, which is actually pretty easy.

    To do that, open up (around line 645 in WordPress 3.6.1)

    wp-includes/rss.php

    and change

    if ( !defined('MAGPIE_CACHE_AGE') ) {
        define('MAGPIE_CACHE_AGE', 60*60); // one hour
    }

    to

    if ( !defined('MAGPIE_CACHE_AGE') ) {
        //define('MAGPIE_CACHE_AGE', 60*60); // one hour
        define('MAGPIE_CACHE_AGE', 0);
    }

    Then you should be able to edit wp-includes/feed-rss2.php though you may need to do a full refresh on your browser with each change.

    This about all I can do with the info given. A bit of a mystery, I’ve never seen a full html page added to the end of an RSS feed before (only error messages). If it makes a difference, it looks like the latest post (Our Team) is what’s being added.

    A second caveat – I’m assuming it’s the rss2 (default) feed. Given the link you provided, it should be.

    Adriaandejongh

    @adriaandejongh

    I put the following at the end of the wp-includes/feed-rss2.php file:

    <?php
    exit;
    ?>

    Now everything works like a charm! Am I doing wordpress damage now, by inserting this?

    No damage, but keep in mind you’ve updated a core file, so:

    1) It didn’t fix the root cause of the problem
    2) You’ll have to repeat each time you upgrade WordPress

    But at least you’re back in business and if you feel courageous, you can poke around. I really can’t tell much more from here 🙂

    I’m just trying to think what would cause it to keep processing. I’ll follow the trail a bit further…maybe not until tomorrow, though.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘RSS error: Extra content at the end of the document’ is closed to new replies.