Sitemap Error: XML or text declaration not at start of entity

Last update: 18 July, 2017

The error:

XML or text declaration not at start of entity

XML declaration allowed only at the start of the document

Cause

This typically happens when a plugin or theme function incorrectly adds an empty whitespace at the beginning of the sitemap. Please view the source code of your sitemap following the steps here.

Yoast SEO XML Sitemaps Whitespace

Solution

As much as we’d love to help, our plugin does not cause this issue. However, the most cause is an empty line at the end of the functions.php file. If there is not empty line in this file, we highly recommend running a conflict check to identify what outputs the empty whitespace. You may also need to clear your caching from your plugins/theme/CDN such as Cloudflare/server caching etc. If you are not sure how to clear caching please speak with your developers or contact your host provider.

Once you have identified whether your theme or a plugin causes the issue, please contact the developers of the theme or plugin for assistance finding and removing the whitespace.

Was this article helpful? ·