Learn how to disable canonical URLs in WordPress. That will make it easier for Google Webmaster Tools to fetch your blogs status.
This post was written by Shumon Islam. His website is full of great info, particularly for WordPress users. Check it out!
What Is a Canonical URL?
If you have a website on WordPress you will find an element like <link rel= “canonical” href= “www.example.com”/> inside the <head> section. Canonical option is the built-in URL redirecting feature of WordPress.
Why we need to disable canonical URLs
We need to disable canonical feature in WordPress for fetching the webpages in Google Webmaster Tools and indexing. If canonical link exists in <head> section Google Webmaster Tool cannot fetch the pages showing an error as “Redirected”. And we know how important tools fetching and indexing of webpages are in case of Search Engine Optimization (SEO). Therefore we can consider to disable canonical feature for a while before implementation of Google Webmaster Tool to ease the process.
Technique to disable Canonical URLs
You will find many tutorials to disable canonical feature, however most of the tutorials may be effective for outdated WordPress versions only. So be careful to read and follow them. The technique I have instructed here is effective to WordPress version 3.0 and later without hampering most of the common URL redirection options of WordPress. I have implemented this technique for my own blog and got the result instantly.
STEP- 1: Go to ‘File Manager‘ of your host, find and open canonical.php file in editing mode inside the folder ‘wp-includes‘ in the root directory shown in the picture below:
STEP- 2: Find the PHP scripts like the following image at lines 332 and 333 (Line numbers may be different):
STEP- 3: Disable those two lines of scripts by adding two slashes “//” like the image below:
LAST STEP: Save the file and you are ready to fetch URLs by Google Webmaster Tools
Do the fetch ASAP before WordPress updates.
IMPORTANT: You have to do this technique every time you go for Google fetching since WordPress keeps updating the files very frequently to their defaults unfortunately