• Resolved slewis0706

    (@slewis0706)


    Hi, I really hope someone could help me. The theme of the website I support (custom made, no support by creators) is breaking the sitemap. I receive the following error:

    error on line 2 at column 6: XML declaration allowed only at the start of the document

    I understand that I’m supposed to remove the blank spaces, but I just can’t find the correct file. I’ve checked in the root folder, I’ve checked in the yoast folder, I checked the functions.php and wp-config.php and everything else I could think of.

    I would greatly appreciate any suggestions.

    • This topic was modified 6 years, 11 months ago by slewis0706.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Michael Ti?a

    (@mikes41720)

    Hi,

    We understand you are encountering the error XML declaration allowed only at the start of the document on your sitemap.

    As much as we’d love to help, our plugin does not cause this issue. However, the cause most often is an empty line at the end of the functions.php file. If there is no empty line in this file, we highly recommend running a conflict check to identify what outputs the empty white space. You may also need to clear your cache 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.

    You can read more about it here — https://kb.yoast.com/kb/xml-sitemap-error/

    Thread Starter slewis0706

    (@slewis0706)

    Hi Mike, thank you for your response. As I’ve already mentioned in my original post I’ve identified that the website theme is causing the issue and I already know that I am supposed to remove the blank space. What I don’t know is where I can find the sitemap or alternatively which php files to check? Because believe me I’ve checked all the files I could find and think of, but I am still receiving the same error.

    Would you be able to tell me where I can find the Yoast sitemap (or if such a file even exists)? I would really appreciate that.

    Hi @slewis0706,

    Yoast SEO creates sitemaps “on fly”. It isn’t file which you can edit. You will see white space when you open HTML source in browser (not only for sitemap files).

    You can try to read closed issues on Github. There are some instructions how it’s possible to fix it. Remove ?> from the end of functions.php and other files (You don’t need PHP closing tag at the end of files).

    Try plugin conflict check (deactivate plugin to plugin and check HTML source at each step).

    I hope that helps,
    Sasa

    Thread Starter slewis0706

    (@slewis0706)

    Hi Sa?a,

    Thank you so much!
    It turns out that I’ve missed a ?> in the functions.options.php file. Removing that made the sitemap appear.

    Really, thank you so much!

    Sarah

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sitemap breaking’ is closed to new replies.