WordPress.org

Ready to get started?Download WordPress

Forums

can't get feed to work (7 posts)

  1. cwd
    Member
    Posted 7 years ago #

    This code:

    <a href="feed:<?php bloginfo('rss2_url'); ?>"><image src="http://faq.wordpress.com/files/2006/07/add-rss20.png" alt="add rss feed" title="add rss feed" /></a>

    generates a url such as:

    http://www.travsavvy.com/?feed=rss2

    Theoretically there is some rewriting going on to get this translated into wp-feed.php, but all I get is an error page in Safari and a bad XML page in FireFox.

    Any help appreciated.

  2. Kafkaesqui

    Posted 7 years ago #

    The error is due to a new line getting added to the very start of your feed document (RSS is an XML format that requires a document begin with <?xml and nothing else). If you look at the source of that page, you'll see an empty line at the top.

    You'll also find the extra line in the source of your blog pages as well.

    Often this is caused by a plugin or some other script echoing a newline. So a good first step to tracking it down is to turn off any plugins you're currently running.

  3. Chris_K
    Member
    Posted 7 years ago #

    the feed starts with a blank line.

    Odds are, you have a plugin that has a blank line before the opening <?php or after the closing ?>. Your mission is to find that plugin and fix it!

    [edit: 20 seconds. dangit!]

  4. cwd
    Member
    Posted 7 years ago #

    Ok, I tried shutting off *all* plugins and the problem persisted. I checked every PHP file and none have leading space prior to the <?php or trailing space after the last ?>. Any further thoughts regarding how best to find the errant blank line?

  5. cwd
    Member
    Posted 7 years ago #

    Update. I punted trying to hunt the errant space down and did this: I edited wp-rss2.php, inserting the following code:

    At the very top:

    function clean_spaces($buffer)
    {
    return trim($buffer);
    }
    ob_clean();
    ob_start('clean_spaces');

    At the very bottom:

    <?php
    ob_end_flush();
    ?>

    This takes a blunt instrument approach to chomping any leading or trailing whitespace. The feed works in FireFox and NewsFire reader. It fails in Safari and IE 7.

    I'm an RSS noob so please forgive what are probably old questions...

    Thx

  6. Chris_K
    Member
    Posted 7 years ago #

    *hands cwd a hammer

    Yep, that's a blunt instrument approach, but it seems to have worked.

    Running your feed through the validator only shows one type of error and that will be cleared up when you upgrade to 2.0.5.

    In an ideal world, perhaps that upgrade may help with your extra cr/lf issue(?).

  7. cwd
    Member
    Posted 7 years ago #

    Well, I fixed that validation nit as well, and all my feeds are now passing the W3C validator. But... only ATOM is displayed at all in Safari. FireFox is fine, IE 7 gets most of the feeds. Not Safari.

    I know this isn't a WP problem, but does anyone know why Safari would give an error on these? BTW: I've used this release of Safari on other RSS feeds no prob.

    Thx

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags