Sitemap error

#527575
  • Resolved ahtisham ali
    Rank Math free

    ‘error on line 3 at column 6: XML declaration allowed only at the start of the document’
    I am getting this error with my sitemap and it’s due to blank lines in sitemap code. I have checked related articles but nothing works. There is no extra line or space in my wp.config.php or functions.php.
    I am not using WPML Plugin or any plugin for caching. I have also tried disabling all plugins other than rank math but not worked.

    sitemap url: https://checkmepcobill.pk/sitemap_index.xml

    error and source images:
    https://imgur.com/a/k5YxW2v

    Please guide. Your quick response would be appreciated.

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

    Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.

    Can you please try following the steps below to see if that works for you?

    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    3. If the above steps doesn’t seem to work, kindly apply the following filter code to your site.

    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
    

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Unfortunately, No above-mentioned solution has worked for me. Please I am not using any caching plugin. is there any other solution? How can I remove blank lines from generated sitemap source ?

    Hello,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    Looking forward to helping you.

    Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    I caught the reason. I am using an external library that has some blank lines in it. Removing blank lines has resolved the issue.

    Hello,

    We’re glad that you managed to resolve this issue.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

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

The ticket ‘Sitemap error’ is closed to new replies.