Talk to us today 0845 86 22 122

Blog.

5th March 2012 |  Written by Dave Ashworth

WordPress Default Canonical Issue And How To Avoid It

Recently, when setting up a new site on the WordPress platform, we noticed a potentially very serious issue with regards default use of the canonical rel=’next’ and rel=’prev’ tags.

The issue arises when you create a series of site pages.  The default setting sees the rel=’next’ and rel=’prev’ applied to pages in the order they are created.

So on your home page, you may see:

<rel ="next" href="http://www.yourdomain.com/page-2" />

Then on the next page:

<rel ="prev" href="http://www.yourdomain.com/" />
<rel ="next" href="http://www.yourdomain.com/page-3" />

And so on. The reason why these were added were apparently for users with disabilities to give them easier access when navigating a sites content, they have been default since WordPress 2.9.

This conflicts greatly with how Google perceive the use of the canonical tag:

They are an issue because the next/prev tags are being adopted to solve pagination issues, particularly prevalent on ecommerce sites where category pages may contain several pages of similar content, for example:

http://www.yourdomain.com/category

http://www.yourdomain.com/category/page-2

http://www.yourdomain.com/category/page-3

The tag allows you to let Google know that the main page here is the first one, and that whilst each page may attract it’s own links, anchor texts, etc – the focus should be consolidated to the main page and be the one shown in the SERPs etc.

This works fine on ecommerce sites and the like, but if you took an existing site with, for example, 10 pages each with their own unique content and created in WordPress – all 10 pages would be default be “canoicalised” to the home page potentially losing rankings on sub pages that target specific terms.

To avoid this, place the following code in your themes functions.php script:

remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

Your Comments

  1. Hi Dave,

    Great article. Cleared a lot of confusion I had, but I have another question:

    I use Yoast SEO plugin. I figured out a way to get rid of the canonicalized tag completely, but it automatically adds “noindex,follow” to page/2/… page/3/, etc.

    It also comes with an option to add “noindex,follow” to tag/page/2/… and category/page/2/…

    Do you recommend this?

  2. Hi Sidharth,

    I would definitely recommended that tag on those pages – basically, you could have any number of pages / tags / categories which will continue to increase as you add content to your blog – depending on how these are optimised, you are potentially creating pages of duplicate content so far as title tags are concerned. By adding that tag, the multiple pages will not get indexed, but you will still allow the pages to be crawled so that the individual posts are accessible.

  3. The language (and substance) of this post is quite confused. rel=prev, rel=next do not indicate ‘canonical’ status. Only rel=canonical does.

    If you have prev,next tags on your paginated content, Google will return the page in its SERPS it feels is most relevant to the query.

    rel prev,next does not ‘canonicalize’ anything.

    It’s true you shouldn’t use rel=canonical on paginated content, but rel=prev, rel=next are NOT the same as rel=canonical

  4. Hi Naoise,

    To confirm what the issue is with the code:

    The rel/prev next tabs is used to consolidate several pages into 1 so that 1 page is returned in search, generally the first one

    more on this here:
    http://googlewebmastercentral.blogspot.co.uk/2011/09/pagination-with-relnext-and-relprev.html

    which confirms that rel next/prev:
    - Consolidate indexing properties, such as links, from the component pages/URLs to the series as a whole (i.e., links should not remain dispersed between page-1.html, page-2.html, etc., but be grouped with the sequence).
    - Send users to the most relevant page/URL—typically the first page of the series.

    If you were to set up a site on wordpress with several pages without fixing the bug, they’d have rel next/prev in place, that would effectively turn your site into one page – so this fix would avoid that – I guess it was referred to as a canonical issue because prev/next effectively takes all pages and rolls them into one…

    In any case, if you don’t amend the bug, you may face issues

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>