The error on line 2 at column 6: XML declaration allowed only at the start of the document on my WordPress feed is really annoying. I spent more than 10 hours trying to fix this error myself. I’m really frustrated because I’ve tried all the solutions I found online but to no avail. I’m almost about to loose hope and just pay someone on fiverr for $5 to fix my error. But my pride stopped me. I’ll be such a loser if I can’t fix this simple error myself. Other have fixed it, a $5.00 can fix it, why can’t I? I already tried this one, this one, and this one, but it didn’t help me with my problem.
The culprit of this error is this single white space. Damn! If only I can modify it easily, but I can’t. That’s why it will be really really really frustrating if I can’t fix it myself.
I already installed a fresh copy of WordPress. A complete fresh copy to a new host! Yes, I already changed my DNS, used a new theme, and everything is new. I imported my database to that new blog and the error occurred again. Weird huh? Yeah, it’s pretty weird. If this happened to you, all you can think of is that the error is within the database. I already installed a fresh WP package, and the error is still here! Watdaheck! I already installed the default theme, and the error is still here! Whoa! Amazing error, it won’t go away! It’s really frustratingggggg!!!
Anyway, after getting tired of fixing it, I modified 9 files inside wp-includes from the fresh WordPress package version 3.3.1. And guess what? That fixed the problem. The following files are deprecated.php, formatting.php, functions.php, load.php, feed-rss.php, feed-rss2.php, feed-rss2-comments.php, feed-rdf.php, and feed.php. I removed all the white spaces at the end of each file and added the magical questions mark and greatar than sign, haha!
Below is the screenshot of the files I modified.
I hope this post helped you out. In case it didn’t, please don’t hesitate to leave a comment below so that I can help you fix your WP site.