Breadcrumbs – Archive title dont shows on taxonomy page

#498302
  • Resolved Anders
    Rank Math free

    Hi

    We found out some problems on our webpage that the archive title/link are not correct when standing in the taxonomy template.

    We have for example a custom post type called “Products”. With taxonomy called “Productcategory”
    Let say that we have an category called “Servers” and a product called “server-v1”

    The breadcrumbs will turn out as following:

    Standning on Archive – Products
    http://www.xxx.se/products
    Breadrumbs
    Home/Products

    Standing on Taxonomy/Category – Servers
    http://www.xxx.se/products/servers
    Breadrumbs
    Home/Productcategory/Servers

    Standing on the product – Server-v1
    http://www.xxx.se/products/servers/server-v1
    Breadrumbs
    Home/Products/Servers/Server-v1

    As you can see in the middle example (Taxonomy template).
    It write out “Productcategory” instead of “Products”.
    And the link get even broken, so you cant even click on that.
    When it should be “products” and clickable link to /products.

    Is it our settings we have done something wrong about?
    Or is this a bug ?

    Best regards
    //Anders

Viewing 10 replies - 1 through 10 (of 10 total)
  • Nigel
    Rank Math business

    Hello,

    Thank you for contacting Rank Math for help with your product category URLs and breadcrumbs.

    Please check your product category settings. To do that, go to your WordPress dashboard > Settings > Permalinks. Delete what is entered in the “Product Category Base” field to reset it to the default and click “Save Changes” at the bottom of the page. Next, check if the product category URL is working.

    If the above does not work, please share your website URL in the designated sensitive data area so we can check the URLs and breadcrumbs to better understand the issue.

    Hope that helps. Please let us know if you have questions.

    Anders
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Anders
    Rank Math free

    I can not see the same settings that you have with for example “product category base”.
    Do we need pro verision?

    Nigel
    Rank Math business

    Hello,

    Sorry for the confusion I caused. The instructions I gave earlier were for WooCommerce products. Please follow the instructions below to fix your custom post type breadcrumbs.

    Please use the filter below to change taxonomy name in breadcrumbs:

    
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$post_type = get_post_type(get_queried_object());
    	
    	if ($post_type == 'product') {
    		$crumbs[1][0] = 'Products';
    		$crumbs[1][1] = 'http://yourCPTURL'; // Change this to match the correct URL
    		
    		$crumbs[2][0] = get_the_title();
    	}
    
    	return $crumbs;
    }, 10, 2);
    

    Hope that helps. Please let us know if you have questions.

    Anders
    Rank Math free

    Hi

    Thanks for your reply.
    This worked only for the single template.

    The problem is still there on the taxonomy page.
    That it says the taxonomy name instead of archive title and a link.

    I did test to write “Produktersss” and you can se in my example. But if you jump back to taxonomy. You will se “Produktkategori”.

    Sensitive updated.

    Nigel
    Rank Math business

    Hello,

    The code snippet I provided works for single product pages. For category archives you will need to adjust the code:

    
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$post_type = get_post_type(get_queried_object());
    	
    	if ($post_type == 'product'|| is_tax('productcategory')) {
    		$crumbs[1][0] = 'Products';
    		$crumbs[1][1] = 'http://yourCPTURL'; // Change this to match the correct URL
    		
    		$crumbs[2][0] = get_the_title();
    	}
    
    	return $crumbs;
    }, 10, 2);
    

    In the code snippet, replace ‘productcategory’ with your taxonomy name.

    Hope that helps. Please let us know if you have questions.

    Anders
    Rank Math free

    Hi

    Thanks for your reply.
    This did worked out now when changed this code and only used “tax” and change number on the title.

    
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$post_type = get_post_type(get_queried_object());
    	
    	if (is_tax('productcategory')) {
    		$crumbs[1][0] = 'Products';
    		$crumbs[1][1] = 'http://yourCPTURL'; // Change this to match the correct URL
    		
    		$crumbs[2][1] = get_the_title();
    	}
    
    	return $crumbs;
    }, 10, 2);
    
    

    So then we need to add this for every CPT:s we will have.
    Is this a bug?
    Or is this something you will add to your main code so this will work by default?

    We did use Yoast before we did go over to just run your plugin. And I know it is a default rule in Yoast, so we dont need to add an extra code for every CPT:s.

    Best regards
    Anders

    Nigel
    Rank Math business

    Hello,

    Showing the post type taxonomy name is the default setting for Rank Math. To change it you will have to add a code snippet like the one above, depending on how you name your post type and taxonomy.

    Hope that answers you. Please let us know if you have other questions.

    Anders
    Rank Math free

    Hi

    Okey, perfect thanks for your help 🙂

    /Anders

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)

The ticket ‘Breadcrumbs – Archive title dont shows on taxonomy page’ is closed to new replies.