How to Add Canonical Urls to WordPress Blogs

It is very essential to add canonical URLs to every WordPress blog web page to avoid duplicate content penalties by search engines. Canonical URLs represent the permalink of the page and help search engines identify and index the page, ignoring other parameters or mistyped URLs loading similar content.

Add Canonical URLs Easily

target canonical url1. WordPress AutoInsert

The latest versions of WordPress automatically adds the canonical URL to the posts and pages only, but not to archives, tags, categories, etc. So while for most blogs, it takes care of all your single posts and pages, it does not fix canonical URL issues for your archives and other paginated categories/tags.

2. SEO WordPress plugins

Popular SEO WordPress plugins like All in One SEO or Yoast SEO have options to set canonical URLs on all your blog pages and are the best way to add canonical URLs in on click.

canonical urls by plugins

3. Premium WordPress Theme Frameworks

Some advanced theme frameworks like Thesis and Genesis have SEO options that allow the auto setting of canonical URLs, without the use of above SEO plugins. However, they are paid WordPress themes, and most WordPress themes might not have options to set canonical URLs automatically.

4. Manual Code Addition

If for some reason you wish to add canonical URLs to all your single posts and pages manually, you can add the following code in the HEAD tags of your HTML code by editing header.php

<?php if (is_singular()) { ?>
<link rel="canonical" href="<?php the_permalink() ?>" />
<?php } ?>

Similarly, if you want to add code manually to any page, you can simply add the canonical URL on the page in the HEAD tags. For example, we have a problem using SEO plugins because we host WordPress in an alternative directory and the SEO plugins cannot create the correct URL for the front page. So we directly add our main front page canonical URL through a separate index.php file.

12 comments on “How to Add Canonical Urls to WordPress Blogs

  1. John D says:

    Hey thanks I have a duplicate content issue that’s been bugging me. Your solutions seem easy enough, will give them a try one by one til I get it right.

  2. Peter Simms says:

    thanks for the information. very useful

  3. חדשות ומבזקים says:

    works with any wp verison ?

  4. Aimee Stewart says:

    I did not know this. I’m gonna follow your advice and put canonical urls on my WP blogs. Thank you.

  5. Rain Check says:

    Shopping with codes discount coupon could be an old concept but online shoppers having begun to realize just how is advantageous it can be. Code discount of provide considerable discounts in your the online stores favorites.

  6. Ester Eva says:

    I found simply the information I already searched all over the place and simply could not come across. What a perfect web site.Good Blog sir… your blog is very helpful.. I am happy to find this post very useful for me, as it contains lot of information

  7. Art Mojo says:

    Creative children have a complete vision of the world, who are not afraid to be expressive, and self-esteem is strengthened through their artistic efforts.

  8. Leticia Bartlett says:

    Want to know more? Check out this video by Matt Cutts of Google who explains the new element in-depth. He mentions me halfway because I created several extensions for canonical URLs at his request.

  9. Boney says:

    Allinoneseo and SEOYoast Plugins are great and very helpful. Of the two, I like SEO-Yoast

  10. Arif says:

    This post is very useful and I learn some think form the post.

  11. Latoya Murray says:

    I have been facing duplicate content issues from since a long time now but now I guess I will be able to solve my issues with the help of this canonical URLs. Nice post!

  12. Nelda Rosa says:

    Fix multiple redirects and canonical redirects. And increase speed of wordpress fine url recognition for SEO by .htaccess file.

Leave a Reply

Your email address will not be published. Required fields are marked *

All comments moderated. Use True name. No irrelevant links. Post useful content.