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

  • Hello,

    I get the error message saying:


    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’ve followed the tutorial: https://community.mythemeshop.com/tutorials/article/52-confirming-a-plugin-conflict/ but that’s not working. I also tried to go to studiohav.com?sitemap=1 as you said in another post but there the sitemap is also not working.
    I did not find anything in the search for other support tickets.

    How can I fix it?

    Regards,

    Melle

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

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

    This error normally comes up when another plugin or a theme modifies the sitemap but since you have already tested for conflicts, it is likely that there is some whitespace on your sitemap index arising from a empty space on your functions.php file.
    You can quickly test if this is the case by switching to one of the stock WP themes and check if you can reproduce this issue.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello,

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

    Thank you.

    I have changed the theme back to normal but I still get the same error message.

    Regards.

    Melle

    HI there,

    Thanks for the follow up.

    It looks like you forgot to share the site URL as well on your last response.

    Please share this info so that I can take a look at this issue.

    Oops, sorry…

    Home

    Hi Melle,

    Thanks for the access.

    It looks like one of the page templates in Divi theme contains the white spaces since the issue cannot be reproduced when you switch to the Twenty Nineteen theme as you can see here:https://snag.gy/Gt9gmZ.jpg
    Just to be sure that the issue is not stemming from our plugin I have also tested whether sitemaps can be created using the Google Sitemaps plugin but it also reports the same error.
    I would suggest that you reach out to the guys from Divi so that they can help in isolating the page template that is adding the white space on the sitemap.

    I hope this info helps.

    Hi Michael,

    There was a blank line in the functions.php file after the ?> of my child theme :).

    I removed it and the problem is now solved. Thank you for the help 🙂

    Hi Melle,

    I am so glad that the issue is fixed.

    If you need help with anything else, please do not hesitate to open a new ticket.

    Thank you.

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

The ticket ‘error on line 2 at column 6: XML declaration allowed only at the start of the do’ is closed to new replies.