Fix Error On Line 2 At Column 6: If you are worrying due to the Yoast Error on line 2 at column 6: XML declaration allowed only at the start of the document, then here I will tell you a short method to away this error immediately. The error often occurs due to issue in function.php so now we will solve this problem step by step. You just follow as under steps to rid this error. I will suggest you please visit here for rid of this error: WordPress Sitemap XML Declaration Allowed.
Fix Error On Line 2 At Column 6 Step By Step
1| Open WordPress Dashboard
First Go to your WordPress Admin Panel and hit on Appearance like shown as under:-
2| Click On Editor
Now click on Editor tab like shown as under picture:-
3| Open Function.PHP
Next step is searching your function.php, just find and click on it.
4| Use The | Sign
When you will open it then keep in mind don’t make changes if you have not any idea about it. Otherwise, you will face other errors. Just go to the end before ?> the closing tag of PHP. Now use (backspace + backslash) and you will get that sign |. Just paste this sign before this tag ?>. Hit update.
5| Remove | Sign
Now remove this sign | and hit update file.
Now check your error has removed.
Sometimes when we enter a backslash in function.php file and update this. We receive an error of 500. So don’t worry we can access this file using CPanel.
Access Function.PHP Via CPanel
Access function PHP file Cpanel. Here I am also sharing that method. Follow as under steps.
1| Access CPanel
First of all, you can access your Cpanel by visiting that URL (http://yourdomain.com/cpanel)
Enter your Username and Password.
Search File Manager.
Click on File Manager and now click on Go.
2| Open Public HTML Folder
Search public_html and click on it. You will find asunder. Now search wp_content.
3| Select Theme Folder
Select Themes folder.
Open that folder which theme is active.
Now Search function.php
4| Edit File
Now you can edit this file by click on edit tab or you can also click on code edit for file opening.
You may also like the solution to this problem in Urdu by visiting this link XML Declaration In Urdu.