Skip to content

WordPress Plugins to Tweak Canonical Links

2010 July 24
by Joost Schuur

I became a bona fide WordPress plugin author yesterday, with the release of two extremely basic plugins that tweak how canonical links are managed by WordPress:

  • Homepage Canonical Link – Adds a canonical link to your blog’s home page, which the current WordPress does not do.
  • Remove Default Canonical Links – Disables WordPress’ default generation of canonical links. Useful if you’re generating your canonical links through other means

Both are intended for WordPress 2.9 and above and have been tested for 3.0. They’re also linked from my new WordPress Projects page.

If you’re not up to speed on canonical links, they help search engines figure out the official URL of a given page, to avoid duplicate content being indexed when query string data might otherwise create multiple URLs to the same page. Setting the canonical links helps with search engine optimization. More details can be found from Matt Cutts at Google on the topic.

They total about 6 lines of actual code, but it was a good way to learn the basics of plugin development and the submission process to the WordPress plugin directory. Thanks go out to Bryan Hadaway (author of his own Canonical Link plugin), who vetted my work and provided the encouragement to submit it. Have a look at his post on getting started with WordPress plugin development or  the official guide to writing a plugin at the WordPress Codex for in depth information.

Share this post:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Google Buzz
  • Twitter
  • email
  • HackerNews
  • Reddit
One Response leave one →
  1. July 30, 2010

    Is there a reason you would want to disable WordPress’ canonical links handling? If it’s built in, what’s the reason to use another plugin, unless there might be some pages which could be duplicated and you want to make sure they are the right ones and not what wordpress things are the right ones.

    I always wondered about WordPress’ canonical links auto-handling. How are they generated? How does wordpress know which is the “right” one to display? How can you tell if wordpress is generating only one canonical link for pages that might be reachable by two different URLs? I’ve noticed this is the case if you check multiple categories, wordpress will allow both to be generated, even though only one is used by default in display.

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS