How to fix the WordPress prepended linebreaks error
October 26th, 2009A while ago I noticed that the RSS feed for MyPieceOfTheInter(.)net stopped working. Strict XML parsers like those in Google Chrome and Internet Explorer refused to parse the RSS feed. Looking around different places, I found that a lot of weirdness was happening.
Viewing the source of the homepage reveled that there were unexpected linebreaks at the top of the document.
This suggested that there was something wrong with the index.php file or the header.php file of the WordPress theme. However, viewing the RSS feed gave the following error:
And looking at the source…
And finally, when I tried to submit a post through Windows Live Writer, I got the following error:
Navigating to the xmlrpc page…
(Clearly I can’t just look at the page through a browser, but there are those strange linebreaks anyway.)
Here I was left scratching my head wondering what might be inserting these mystery linebreaks. I even wrote a little test.php file to make sure the server wasn’t doing it.
The problem? Linebreaks after the closing php tags in included php files. The main culprit: plugins.
As a test I could type “hello, world” where I have highlighted, and it would appear in every HTML page and RSS feed served by my WordPress blog. >.< For this to truly make sense, you’d need to know about PHP’s include function.
So I disabled all my pluggins and re-enabled them one-by-one to find the offending pluggins. Counterize II was the only one. I used WordPress’s built-in plugin editor to fix Counterize II’s code.
My wp-config.php files was also an offender.
*sigh* problem solved.
0 comments
Leave a comment
Read more
« New and improved! The previous post on one line! — You know you envy my home server on a fridge »
