Sitemap Error on line 2 at column 6

Sitemap error

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

so you’re getting this error trying to make or get a sitemap, and you have tried multiple sitemap generators lol, well i was stuck on this for weeks and i’ll tell you why.

see the answer to the problem is simple enough, they keep saying there might be an empty space in your functions.php BUT it’s not very simple is it, seaming there were always empty or white space in that file.

so you finally come across an article that specifies there might be an empty line/ rows outside of the <?php and ?> tags of the document and well even that doesn’t help lol so you keep searching and they say well you need to get rid of the empty line within the document and you think to yourself, WHAAT there’s empty lines every where and it used to work fine before with all these unused/empty lines so witch one? grrr

so learn from my experience cos i did it the hard way as per usual, get Rid of all the empty lines even within the (Beginning) <?php and ?> (End) literally DO NOT LEAVE A SINGLE EMPTY LINE in the functions.php or theme functions.php. 

yes it might take ages cos its a long bloody file but its worth it to get your sitemap.xml up n running and i think you know why.

cheers and have fun 😉

 

on the search for knowledge.