Unwanted blank lines before tag

I’ve a strange problem with an Autofocus theme.

In my templates file, header.php, I’ve a code like this (and is correct)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

When I look at the source code of the generated HTML, I found something like this

[blank]
[blank]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

The extra blank lines are breaking my RSS feeds…

Other info:

  • No filters on the content except wpautop
  • functions.php doesn’t do anything on the content
  • Plugins All In One Seo, WP Stats, Smiley Remover, SEO Friendly images

Any clues?

2 Answers
2

the_content doesn’t affect the DOCTYPE and <html> tags, only the post/page content.

One of your plugins, or something else in the theme is either throwing an error, or is printing something earlier than it should.

Have you tried:

  • Disabling each plugin one by one and see when it is fixed.
  • Editing wp-config.php and adding define( 'WP_DEBUG', true ); to look for errors

Leave a Comment