Error for sitemap

#1057937
  • Resolved Rob
    Rank Math free

    I keep getting this error for the sitemap on isleflow.com:

    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 spoke to the webmaster and he says the site code is good, but something on Rankmath is not working. Please help me.

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

    We apologize for the issue you are facing with your sitemap. The error message you are seeing, "XML declaration allowed only at the start of the document," typically indicates that there are extra spaces or blank lines before the XML declaration in your sitemap file.

    Here are a few steps you can take to resolve this issue:

    1. Check for Blank Spaces: Ensure there are no blank lines or spaces before the ` line in your sitemap. This could be caused by a blank line in yourwp-config.phpfile or your theme'sfunctions.php` file.

    2. Plugin Conflicts: Sometimes, plugin conflicts can cause issues with the sitemap. You can check for conflicts using the Health Check plugin.

    3. Clear Cache: If you have caching enabled on your site, make sure to clear your cache as it might be serving an outdated version of your sitemap.

    4. Flush Permalinks: Go to your WordPress admin area, navigate to Settings → Permalinks, and click the “Save Changes” button without making any changes. This can help refresh your permalinks and might resolve the issue.

    If these steps do not resolve the issue, please reply to this ticket with any additional details or errors you encounter, and a human agent from our support team will assist you further. Thank you for bringing this concern to our attention!

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    The issue you are seeing is caused by an XML declaration error on your sitemap. This means that there is some extra content or whitespace before the XML declaration in your sitemap file.

    The most common reason for this error is a whitespace in your theme code, such as a blank line or space in your wp-config.php file or your theme’s functions.php file. This can happen when you edit these files manually or use a plugin or theme that modifies them.

    To fix this error, you need to find and remove the whitespace from your theme code. You can follow this guide to troubleshoot and resolve this issue: https://rankmath.com/kb/fix-sitemap-issues/#xml-text-declaration

    If the issue persists, you can also use this script to automatically fix this error: https://wejn.org/stuff/wejnswpwhitespacefix.php.html

    Looking forward to helping 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 ‘Error for sitemap’ is closed to new replies.