WordPress Blank Line Before XML Declaration (RSS Feed Does Not Validate)

WordPress RSS Feed Does Not Validate. Here is a solution for your WordPress blank line before XML declaration start. It would happen when we are trying to adding a certain RSS feed to FeedBurner. We would get an error message “Blank line before XML declaration (WordPress)”. Ideally, this message says the XML RSS feed was not well-formed.

WordPress RSS Feed Does Not Validate

Explanation

If any XML declaration <?xml ... ?> appears in your feed, it must be starting from the first line without any whitespace.

Solutions

Maybe the solution is to remove any blank lines outside of the <?php ... ?> in the PHP code of theme files. Most probably it would exist in your theme files.

First of all you have to check your theme functions.php file for blank lines outside of <?php and ?> bracketed sections. Here 3 possibility you might have to check and fix it.

  1. Check before starting PHP tag. If any empty line remove it.
                // Remove this empty line
    <?php
        ...
        ...
  2. Check after closing PHP tag, any empty line remove it.
    ?>
                // Remove this empty line
  3. The third possibility, more than one PHP sections in the theme functions.php file. As a result, it would happen. However, you may check any empty line between PHP sections.
    <?php
        ...
        ...
    ?>
                // Remove this empty line between PHP sections
    <?php
        ...
        ...
    ?>

If still, your problem exists furthermore you probably have to check above 3 possibilities in wp-config.php, wp-rss2.php, wp-atom.php files. Sure your error solved. You can also refer to feed documentation.

You can validate your feed on here go to Feed Validator and enter your feed URL. You can explore here other WordPress related posts.

WordPress Blank Line Before XML Declaration (RSS Feed Does Not Validate)

WordPress Blank Line Before XML Declaration

WordPress RSS Feed Does Not Validate

Here is a solution for your WordPress blank line before XML declaration start. It would happen when we are trying to adding a certain RSS feed to FeedBurner. Ideally, this message says the XML RSS feed was not well-formed.

If you like our article, please consider buying a coffee for us.
Thanks for your support!

Support us on Buy me a coffee! Buy me a coffee!



2 Responses Leave a Comment

  1. Thanks! – That was a massive help and I got my feed to validate by removing the closing php tag from my functions.php file in my child theme.

    1. blank
      SpeedySense Editorial November 14, 2019 at 12:35 PM

      Thank you @Gordon

Join the Discussion.