Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Fixing Duplicate Canonical Link Element in WordPress

If you work with Wordpress blogs and websites you will, no doubt, have had lots of fun over the years with duplicate content and spent plenty of time trying a) get it out of Google's index and/or b) stopping it getting in there in the first place.

The introduction of support for the Canonical link element by Google and the other search engines offered a powerful addition to the ways in which duplicate content can be suppressed. The canonical link element and its use has been widely discussed in the blogosphere so I won't go into it here. Check out Matt Cutts' Canonical Link Element in 5 minutes blog post for a good explanation if you don't know about it already.

Back to WordPress. The two popular SEO plugins Platinum Seo Pack and All-in-one SEO Pack have supported addition of canonical link elements to posts and pages for a while now. I noticed recently that on a couple of my new sites using WordPress 2.9.2 there were duplicated canonical link elements in the header: -

<link rel='canonical' href='http://www.featheredowl.com' />

which had been added by WordPress and, a bit further down: -

<link rel="canonical" href="http://www.featheredowl.com/" />

in the Platinum SEO pack section.

Further investigation revealed that WordPress has supported the canonical link element and added this by default to all posts and pages since version 2.9.0. Now, I don't know for sure if this is a bad thing, but intuition suggests that duplicated meta data in the header of a Web page won't make a search engine think it's a better quality page than if that data was only specified once. So, how to get rid of the duplicates?

It's easy. Either a) turn off "canonical URLs" in your SEO plugin or b) comment out the following line in wp-includes/default-filters.php: -

add_action( 'wp_head', 'rel_canonical' );

Personally, I commented out the bit of the WordPress script. After all, the SEO plugin writers thought if it first.

The post Fixing Duplicate Canonical Link Element in WordPress appeared first on Feathered Owl.



This post first appeared on Blog, please read the originial post: here

Share the post

Fixing Duplicate Canonical Link Element in WordPress

×

Subscribe to Blog

Get updates delivered right to your inbox!

Thank you for your subscription

×