I am getting a similar sitemap error. Running WP 4.5.3 and Yoast SEO 3.4. I was experiencing this error on an older version and updated, first to 3.3.4, then to 3.4 today.
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.
The above error is when viewing the page in Chrome. Line 1 is a blank line, which is the source of the problem.
This seems like a serious bug to me. It is technically incorrect XML even if some or most parsers do accept it. Is there some fix I can apply to remedy it, even if this bug report is not accepted by the maintainer?
My apologies. I see in another post that this is not from your plugin. Can you explain how the plugin is invoked so I can understand where the problem is occurring?
I often find after YOAST SEO upgrade (one presumes you are deleting old folder and adding new one, not “overwriting”) …
a) resave permalinks
b) clear transients with wp-optimize
c) go to Yoast > sitemaps “save”
d) change number from 1000 to 900; save
e) click link to sitemap on the yoast screen
Or, after above – if didnt’ work:
a) disable plugin on plugin menu
b) reactivate plugin
c) resave permalinks
d) check link to sitemap again
Should fix it unless you have conflict or other issue 🙂
This warning means there is something before the opening xml tag, usually white space or blank lines, which may cause search engines to see an empty sitemap regardless of the remaining valid code.
As you both have confirmed you see a blank line or two, something in your setup is outputting these lines. The best way to figure out what outputs the blank lines is to run a conflict check. If you are unfamiliar with checking for conflicts, we wrote a small guide that will walk you through the steps. You can find it here: How To Check For Plugin Conflicts