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:
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 );