WordPress XML Sitemap problem

Let’s imagine that we have just installed a plugin for generating a Sitemap, check certain Sitemap URL, and received the following error:

This page contains the following errors:
error on line * at column *: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

The reason is that one of the php files of the site has key phrase <?php not at the beginning of the first line, or not at the first line, like:

    <?php ...


<?php ...

You need to fix it by removing the whitespace before <?php.

  • Check the file <wordpress_installation_path>/wp-config.php;
  • Change design theme to another. If the problem disappears, then you need to check all the existing php files in the origin theme;
  • Check all plugins. They may contain some incorrect php files. Instructions can be found in this article.
Telegram channel

If you still have any questions, feel free to ask me in the comments under this article or write me at promark33@gmail.com.

If I saved your day, you can support me 🤝

Leave a Reply

Your email address will not be published. Required fields are marked *