General Topics

Fix Error On Line 2 At Column 6 In Easy Steps

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

First Go to your WordPress Admin Panel and hit on Appearance like shown as under:-

go-in-admin-panel

Now click on Editor tab like shown as under picture:-

click-on-editor

Next step is searching your function.php, just find and click on it.

click-on-theme-functions

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.

use-sign-and-update-file

Now remove this sign | and hit update file.

remove-sign-and-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 file Cpanel. Here I am also sharing that method. Follow as under steps.

First of all, you can access your Cpanel by visiting that URL (http://yourdomain.com/cpanel)

Enter your Username and Password.

Search File Manager.

File Manager CPanel

Click on File Manager and now click on Go.

Search public_html and click on it. You will find as under. Now search wp_content.

wp-content

Select Themes folder.

Open that folder which theme is active.

Now Search function.php

function

Now you can edit this file by click on edit tab or you can also click on code edit for file opening.

edit-file

If you are facing this issue till then you can also leave a comment. You may also like the solution to this problem in Urdu by visiting this link WordPress Error Line 2 At Column 6 XML Declaration In Urdu.

Show More

Muhammad Awais Azeem

"Global Blurb since 2015" M. Awais Azeem is the CEO and founder of Global Blurb. The blog designed to share ideas about different topics. My profession is Accountant and I have completed CA Inter from Institute of Chartered Accountants of Pakistan. Me and my time present to sort out any issue regarding SEO, Blogging, Content Marketing and WordPress. Hire Us and Goodbye difficulty.

Related Articles

Want to contribute