How can I fix this sitemap error?

#823347
  • Resolved Marble Agency
    Rank Math free

    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.

    I have removed whitespace in functions.php and wp-config.php and also removed the cache and still not working. Is there anything I can do to sort this? I have the same problem on two sites.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I’m sorry to hear about the sitemap error you are facing on your websites. To resolve the "XML declaration allowed only at the start of the document" issue, you can follow these steps:

    1. Check for Plugin Conflict:

      • Use the Health Check plugin to identify any conflicts caused by plugins. Deactivate all plugins except Rank Math and check if the issue persists.
    2. Add Filter to Theme’s rank-math.php File:

      • If removing whitespace and cache didn’t work, you can add a filter to your theme’s rank-math.php file to disable sitemap caching. Here’s how:
        • Navigate to WordPress Dashboard → Tools → Theme File Editor or WordPress Dashboard → Appearance → Theme File Editor.
        • Choose the rank-math.php file and add the following filter:
          add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
        • Save the changes and clear your website cache.
    3. Confirm Sitemap Functionality:

      • After applying the changes, check your sitemap using an XML Sitemap validator to ensure the error is resolved.

    If these steps do not resolve the issue, please feel free to reach out to our support team directly here for further assistance. We are here to help you with any additional support you may need.

    Thank you for your patience and understanding. If you have any more questions or need further assistance, please let us know.

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    How to Fix "Incorrect HTTP Header Content-Type" Error in Sitemaps » Rank Math

    Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    We checked your sitemap and we can see it is working properly without any issues. Please check the screenshot in the sensitive data section for reference.

    If you’re still facing the issue, please clear your browser cache and check again.

    Hope that helps and please don’t hesitate to let us know if you have any other questions.
     
    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The ticket ‘How can I fix this sitemap error?’ is closed to new replies.