Forums

Blank line added in feed, causing feed not to work (20 posts)

  1. Bramme
    Member
    Posted 3 years ago #

    Hello all

    I just discovered my feeds are not working.

    feedvalidator.org says the following: http://feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.bramme.net%2Ffeed%2F

    I have checked /wp-includes/feed-rss2.php but see nothing that could be adding the blank line. However, when trying to access http://www.bramme.net/wp-includes/feed-rss2.php, I get a "call to undefined function get_option()" fatal error.

    As this is a fresh WordPress install, with only a few plugins, I was wondering if this could be a server configuration error.

    Thanks in advance!

  2. simplygrey
    Member
    Posted 3 years ago #

    Yeah, I think I'm having the same sort of problem.

    FYI, there's also this thread which seems to be about the same error. I've posted details about my troubles there.

    ~G

  3. simplygrey
    Member
    Posted 3 years ago #

    OK, I've found that deleting blank lines at the end of (and throughout) wp-config.php has solved my problems.

    You may also need to clear your browser's cache before retrying to see if the problem has been fixed.

    HTH

    ~G

    P.S. I've posted a longer reply on the other thread referenced above, but I'm not sure there's much in the way of extra info there.

  4. DigitalMusings
    Member
    Posted 3 years ago #

    I tried the idea, it didnt work for me though.

    I have removed the black lines as well as spaces from the wp-config file, but the Feed still doesnt work!! :(

    Help!?

  5. magneto_ms
    Member
    Posted 3 years ago #

    @simplygray: that method didn't work for me. :(

    can anybody crack this?? i am pulling my hair out trying to figure this one out.

  6. Bramme
    Member
    Posted 3 years ago #

    Clearing that one line did not work for me. I am completely baffled.

  7. DigitalMusings
    Member
    Posted 3 years ago #

    This is a major setback for a blog, as a blog needs an RSS Feed to thrive and grow. People are losing subscribers because of this issue and some of them would never come back. There are many threads listed with the same issue, but none has a workable resolution.

    Please some one provide some suggestions.

    Any moderators who might help? Thanks!

  8. Otto
    Tech Ninja
    Posted 3 years ago #

    In order for anybody to help you with feed issues, they need to know your actual feed URL.

    90% of the time, it's the blank line issue.
    9% of the time, it's somebody using the wrong URL.
    1% of the time, it's more complex than that.

    But regardless, we need the actual URL you're using, as well as the URL of your blog. Then we can look at the feed and see the issue.

    It also helps to turn off the Feedburner Feedsmith plugin before giving us the URL. We can't diagnose your blog's feed problem when your blog is redirecting us to a broken Feedburner URL.

    So, if you want help, do this:
    1. State the problem.
    2. Give a URL.
    3. Disable your plugins. Preferably all of them, but if this is not feasible, then any plugins that may affect your feed.

    Most importantly, do it in a NEW THREAD. Posting in half a dozen older threads makes people a) ignore you and b) ignore the original poster as well. Don't hijack somebody else's problem. Start your own thread for your own problems.

  9. Otto
    Tech Ninja
    Posted 3 years ago #

    However, when trying to access http://www.bramme.net/wp-includes/feed-rss2.php, I get a "call to undefined function get_option()" fatal error.

    That's because you're not supposed to use that URL for the "feed".

    Your feed URL is http://www.bramme.net/feed/ . If you use the wrong URL, get the wrong results.

    ALL WordPress feed URL's are either BLOGURL/feed/ or BLOGURL/?feed=rss2. this is dependent on your permalink settings. No other URL is valid for your main blog feed. In fact, you can take any URL on any WP site and simply add /feed/ or feed=rss2 to the end of it to get a feed of that URL.

    Now, in your particular case, you also have the blank line issue. Since the blank line shows up on both your feed and your main site, I'd say that it's likely in your wp-config.php file. Quick fix: Remove the ending ?> from that file entirely.

  10. Bramme
    Member
    Posted 3 years ago #

    Otto, thank you for your replies, but please note I did all of your above mentioned. I did state the problem, post my feed (albeit a bit disguised) but did not know anything about the plugins (I did disable the feedburner plugin though), but this did not change anything.

    I consider myself a wisened php developer and did allready consider removing the ending ?> tags (something CodeIgniter for example does in every PHP file, preventing any "output already" sent errors). I am just wondering now which other files get loaded...

  11. Bramme
    Member
    Posted 3 years ago #

    Note: I have tried manipulating the output with ob_start and ob_get_contents(), but that just included my header twice, which is really weird (ob_end_flush didn't cause any problems)...

  12. Otto
    Tech Ninja
    Posted 3 years ago #

    Bramme: Second most likely location: Your theme's "functions.php" file. That file always gets loaded as well, and is not a WordPress core file.

    Third most likely location: A plugin. No telling which one except by trial/error.

  13. Bramme
    Member
    Posted 3 years ago #

    None of the above worked. I'm starting to think I'll have to search every file and remove the ending ?> tag...

    Could this be server related? Some setting in Apache or so that goes wonky?

    If this were my own code, I'd say "tough luck, my own damn fault" but seeing as a lot of people encounter this problem, I really think some effort should be made into finding a solution.

    The solution posted here (http://www.wynia.org/wordpress/2006/01/19/rss-feeds-broken-wordpress-plugins-and-duct-tape-solutions/) worked for the blank line on my homepage, however not for the line in my feed.

  14. Bramme
    Member
    Posted 3 years ago #

    Update: and suddenly, after deleting said (tried but failed) fix, it worked again. File encoding anyone?

  15. pshoeg
    Member
    Posted 3 years ago #

    Here is the solution!

  16. Bramme
    Member
    Posted 3 years ago #

    That did not work for me. I still believe having to hack the wordpress index file is not really a solution. I'd like to see an answer what's causing this: is it a blank line in one of the files, is it some encoding problem???

    Anyhow, I've just had an e-mail my site was down, showing nothing but a blank page. I've replaced all the files I deleted the closing tags from with their originals and removed the ob hack. In the back of my head, I'm thinking something like caching caused the problem (I do have caching enabled in my .htaccess).

    This however means my feed is once more down :(
    I've tried the output hack, but to my surprise, it did not work... Is there anything else creating output for the feeds except feed-rss2.php (or other similar .php file)?

  17. Bramme
    Member
    Posted 3 years ago #

    It seems I have finally uncovered the problem.

    To create my blog's theme, I downloaded a blank sandbox theme (I believe from wpcandy.com) and used that.

    Just now, I tried moving my site to another host and see what that gave. When trying to login I suddenly got a "headers already sent" error which pointed to my theme/functions.php directory. When I looked at that, I saw the following:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '<h4>',
    'after_title' => '</h4>',
    ));
    ?>
    
    <?php // for sidebar.php if needed (remove the // below the if() statement) ?>
    <?php // if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : endif; ?>

    Removing second to last line, causing the problems: apparently, simply putting a php comment, also counts as whitespace...

    Deleting those 2 last lines solved all my problems.

  18. Otto
    Tech Ninja
    Posted 3 years ago #

    No, having that blank line between the PHP bits counts as whitespace.

    'after_title' => '</h4>',
    ));
    ?>
    (SEE ME? I'M WHITESPACE!)
    <?php // for sidebar.php if nee

    A theme's functions.php file must start with <?php and end with ?> and not create any output in between.

  19. Guy.Fakery
    Member
    Posted 3 years ago #

    I would just like to say thanks to pshoeg for pointing us to the answer to this riddle.

    We tried every other cure we could find, but his suggestion of using the php file at http://wejn.org/stuff/wejnswpwhitespacefix.php.html worked for us.

    All credit to the author of the code too for working out a solution.

    I suspect his code will help many others with this same problem as it's a generic solution that should cover white line faults in code from third party template vendors.

    We used the .htaccess method from the page mentioned in case anyone is interested.

  20. captainmatt
    Member
    Posted 3 years ago #

    How did you install pshoeg php file? I tried and couldn't get it to work.

Topic Closed

This topic has been closed to new replies.

About this Topic