Today we will discuss WordPress sitemap XML declaration allowed only at the start of the document. Here you will able to know how to fix WordPress sitemap XML declaration allowed only error. This is a common error which faces while sitemap generates. So just see the solution of this error and the reason also. If you have failed to solve this error then check your file and clean from third party functions. Let’s see and read more about it.
Reason Of WordPress Sitemap XML Declaration Allowed
If you see the reason of WordPress sitemap XML declaration allowed error. Then you see this occur due to space in function.php. If you remove the space then you can rid of this issue. The second reason of this error is that. When we use different functions of the third party. Then we also face the error on line 2 at column 6 error. So before using any type of third party code. First, install local host on your PC or Mac and check on it. After that, you can use for your online site. Because when sitemap will not work. Then how to possible that Search Engine will pick it and index. Now just see how to rid of the error on line 2 at column 6.
Fix Error On Line 2 at Column 6
Now just learn how to fix error on line 2 at column 6 (WordPress sitemap XML declaration allowed) error. For this purpose, you need to edit your theme file. Which theme file and how to edit? Here you will see every step with the help of screen shots. Just follow these to rid of error on line 2 at column 6 XML declaration allowed only at the start of the document Yoast.
- First of all, go to your WordPress dashboard and click on Appearance » Editor
- After clicking on the editor you will get a list of files. Just see here (Theme Functions) function.php file. Or you can also fin by pressing Ctrl + F button. Now here write function.php and the file will highlight. You can also access your function.php file using CPanel. So just read the tutorial how to? Access function.php WordPress.
- Now the turn to check space before and after opening tag of PHP. You can also see under here in the screen shot.
- If you see space after this tag then remove. Now scroll down and see space before and after of closing tag of PHP. You can also see here under:
- If you find space then remove it and check. Is it working or not? If work then great otherwise see next step.
- Just insert “|” straight line after closing tag of PHP and update file. When the file has updated then remove it and again update file.
This was the method to rid of WordPress sitemap XML declaration allowed error. Don’t forget to share your great ideas in the comment section. If you want to increase your site speed then read about it: Best Setting Of The W3 Total Cache For Fast Speed.