Check the functions.php file in your theme folder. Make sure that there aren’t any characters after the last ?> tag, including new lines.
Thread Starter
rrmia
(@rrmia)
I didn’t have those characters but I did have a few spaces before “<?php”, removing it fixed the issue. Thanks!
I’m having almost exactly the same error:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.
But I looked in functions.php to see if there were any extra spaces before/after and there aren’t. Do you know if there’s something else that could be causing this?
Same error as well:
This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.
Any suggestions? I have double checked the functions.php.
Thanks,
Daniel
I realized that almost any PHP file with spaces outside could be causing this problem. It turned out to be one of the plugins we had installed (actually I think it turned out to be a few). I went through, de-installed all plugins, checked that it worked, then started reinstalling them incrementally to figure out which was causing the problem. Then I went through their php files and took out all spaces outside of <?php ?>. It’s a bit of a pain but it worked.