Give help. Get help.

  • # April 29, 2009 at 2:20 pm

    Hi all — I’m tweaking an existing wordpress theme to suit my needs (with little or no html, css or php experience — yikes), but I’m really trying to give each of my issues an honest go before I post here for help. I don’t want to abuse these forums! That having been said:

    My RSS feeds for both posts and comments appear to be broken, and clicking on the "subscribe" returns this error message:

    XML Parsing Error: XML or text declaration not at start of entity
    Line Number 3, Column 1:
    <?xml version="1.0" encoding="UTF-8"?><rss version="2.0"

    I thought it would lead me to an rss file that I could start poking around in, but all the rss-related php files in my directory are just redirects, and I cant figure out where they’re redirecting to (they look like this:)

    < ?php /** * Redirects to the RSS2 feed * This file is deprecated and only exists for backwards compatibility * * @package WordPress */ require( './wp-load.php' ); wp_redirect( get_bloginfo( 'rss2_url' ), 301 ); ?>

    Anybody have any insight to get this working? The weird thing is, I switched the theme this morning to see if that would fix the problem (it has with some other stuff, giving me clues on where to start hunting for answers) and the RSS feeds worked briefly! They kept working when I switched back for a short period, then stopped again. Repeating my theme-switching tactic failed to repeat this result. A hallucination, perhaps?

    Site is at:

    # April 30, 2009 at 2:48 pm


    It looks like the file that’s giving me trouble is my feed.rss2.php file in my wp-includes directory. I think? But the theoretically offensive lines of code read

    echo ‘< ?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>‘;

    rather than

    < ?xml version="1.0" encoding="UTF-8"?>

    as displayed in my error message. I’ve tried messing around with it to no avail (not surprising since all of my tweaking is pure speculative experimentation), and also pasting in a supposedly curative code snippet that I found here: … on-how-to/

    No progress yet. My research leads me to believe that the problem could be extra spaces in my code somewhere (which is what the solution at the link tries to fix). Anybody have any insight?

    # April 30, 2009 at 3:58 pm

    Probably a silly question but have you tried this

    # April 30, 2009 at 11:31 pm

    No, that actually helps a lot! According to the validator I’ve got a spare line at the beginning of my feed, but I have no idea how it’s getting there. I’ve been going over my rss-related php files, my wp-config file and my functions.php file, but haven’t found anything that seems to be helping.

    The feeds still work in google reader, it turns out, and probably some others. But I know I need to get rid of that extra line if I want to be rid or the error message when you click on my rss feed button.

    # May 1, 2009 at 5:49 am

    I have a vague recollection of reading somewhere else that your problem could be plugin related. Try disabling your plugins one by one, each time checking your feed.

    # May 1, 2009 at 12:07 pm

    Thanks, I actually tried disabling all plugins, and I’m still in the same boat with the rss feeds. It seems to be theme-independent now, so something in one of my rss2 or config files or somewhere is adding that extra line. I’m still looking for it.

    # May 1, 2009 at 12:26 pm

    The only thing I can think of now, and you’re gonna hate me for this, is a clean install.

    It sounds like you’ve been messing about with some of the core files, maybe try replacing just the files you have been working on.

    Otherwise, backup your posts, do a clean install check the rss works, activate your theme, check again, activate your plugins, check again, import your backed up posts, check again etc.

    # May 1, 2009 at 1:15 pm

    Yeah, I think I’m going to have to try that at some point — it’s not the posts I’m worried about, because this is a pre-launch site that I’m building from the ground up. It’s all the tweaking I’ve done on the theme so far.

    Another thought — when I view the source code of my main page, it has that extra line at the top, just like my feed does. I can’t find it in my header or page templates — surely this is a symptom of my overall problem.

    I just tried switching to the default theme, and now my rss feed validates — my confusion on this before stems from the fact that the feed apparently doesn’t update until I add a new post, so I was still getting the error when I switched themes, and thinking the problem wasn’t fixed. What I needed to do was validate the theme instead. Also, in the default theme that spare line is gone from my main page source code.

    So it’s definitely something in my theme throwing that extra line up. I think this theme was broken when I got it.

    # May 1, 2009 at 1:37 pm

    In that case my money is on functions.php.

    # May 1, 2009 at 1:44 pm

    My functions.php file is very, very short. Do you see anything wrong with this?

    < ?php if ( function_exists('register_sidebar') ) register_sidebars(2, array( 'before_widget' => ‘

      ‘after_widget’ => ‘

    ‘before_title’ => ‘

    ‘after_title’ => ‘


    # May 1, 2009 at 2:08 pm

    Provided there is no space before or after that code, then I stand corrected.

    Then the only other thing I can think of that is specific to a theme that might affect it is the header.php. Compare that to the header.php in the default theme, is there anything obviously different?

    I’m clutching at straws here. Can you tell? :D

    # May 1, 2009 at 3:37 pm

    Well, my header.php file doesn’t have a <?php /* theme name */ ?>line like the default, but adding one doesn’t help. I checked several themes, and some have it, some don’t.

    The first line in my header is

    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    and yet in my source code for the page, there’s an extra, blank line above this (which goes away when I switch themes). I guess wordpress uses pretty much all of the php files in my themes folder to generate page code, but what would stick a blank line at the very to of my pages, and at the top of my rss code?

    I appreciate, by the way, all your insight to which straws I should try grasping at. :)

    # May 1, 2009 at 3:54 pm

    I refuse to be beaten!!! :x

    Just found this

    # May 1, 2009 at 3:58 pm


    I’m just not sure where — but replacing my functions file with the default theme one fixes the problem (both in the feed and the page code) of course it screws my sidebar all up.

    < ?php if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => ‘

      ‘after_widget’ => ‘

    ‘before_title’ => ‘

    ‘after_title’ => ‘


    So I have no extra spaces before of after this in my file — does this file call information from other places that could be screwing it up? Iget the following errors when I try to validate it:

    # Line 4, Column 28: character “(” not allowed in prolog

    ‘before_widget’ => (


      # Error Line 5, Column 27: character “‘” not allowed in prolog

      ‘after_widget’ => ‘


    # Error Line 6, Column 27: character “‘” not allowed in prolog

    ‘before_title’ => ‘


    # Error Line 7, Column 26: character “‘” not allowed in prolog

    ‘after_title’ => ‘


    # Error Line 9, Column 3: end of document in prolog

    Aren’t those apostrophes supposed to be there, though? Or is the apostrophe the crux of the biscuit> :shock:

    # May 1, 2009 at 4:00 pm

    I’m going to try your fix above right now, though…

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.