latest tweets:

Jump to content.

How to fix the WordPress prepended linebreaks error

October 26th, 2009

A 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.
wordpress line break error 1

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:
wordpress line break error 2 

And looking at the source…
wordpress line break error 3

And finally, when I tried to submit a post through Windows Live Writer, I got the following error:
wordpress line break error 4

Navigating to the xmlrpc page…
wordpress line break error 5

(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.
wordpress line break error 6

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.
wordpress_line_break_error_7

*sigh* problem solved.

Share and Enjoy:
  • Digg
  • email
  • Google Bookmarks
  • Live
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter

0 comments

Leave a comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Read more

« »


Switch to our mobile site