WordPress SEO by Yoast
Canonical URL for Category&Taxonomy Page Points to Category (2 posts)

  1. calciumwaste
    Posted 1 year ago #

    My site structure is somewhat complicated and I've had a lot of issues with the rel=canonical pointing to a page that has different content, leading Google to ignore my canonical URLs. Currently Google is indexing the non-canonical pages, but they are usually outranked by a less relevant canonical URL.

    The core problem is that for a URL that has multiple taxonomies, the canonical points back to the main category archive. ie. the canonical on "mydomain.com/category/category-slug/?tag=tag-slug" is always "mydomain.com/category/category-slug/". I don't know if this is the intended behavior for the plugin, but it does not work for me.

    Is there to fix this so that the canonical URL doesn't remove tags or custom taxonomies from the URL?


  2. the_lar
    Posted 1 year ago #

    I have a similar issue, I have a fairly complicated scenario where I have set up dummy terms in custom taxonomies and use these as landing pages, I then use rewrites to extract variables and pull content in from other custom post types based on these. The 'canonical' ref on my custom taxonomy archive pages generated by Yoast was completely wrong. This is how I've disabled it:

    //Try to remove canonical on custom taxonomy archive pages
    function wpseo_canonical_exclude( $canonical ) {
    	if (is_tax()) {
    		$canonical = false;
    	return $canonical;
    add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );

    Obviously this disables canonical for ALL custom taxonomy archives but you could check for a particular one.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress SEO by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic