How to add Tag Pages in the breadcrumbs

#523457
  • Resolved Daniel Braga
    Rank Math pro
    Content AI Starter Trial

    Hey guys, I have breadcrumbs enable on my website. it does show my category but i would like to show my tag page as well.

    Is it possible for me to add a tag page in my breadcrumb?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    To include your primary tags on Rank Math breadcrumbs, head over to Rank Math > Titles & Meta > [Post type] and set the Primary Taxonomy

    Taxonomy

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

    Daniel Braga
    Rank Math pro
    Content AI Starter Trial

    Hi Sakib,

    I did that and now it turned to showing up the tags. That’s great, but I still want to use my Kitchen Category and then show the tag of the type of product in the URL example here

    https://itensdecasa.com/melhor-grill-eletrico/

    An ideal breadcrumb for me would be:

    Itens de Casa (home) > Cozinha (kitchen category) > Grill Sanduicheira (tag page where we talk about grills)

    It’s possible I can mix and match tags? In this case I wanted to display the girll tag inside the kitchen category.

    grill tag: https://itensdecasa.com/tag/grill-sanduicheira/

    Kitchen category: https://itensdecasa.com/cozinha/

    Hello,

    We deeply apologize for the delay in response.

    Please try adding the following filter in order to show tags and categories in your posts:

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$get_post_tags = get_the_tags();
    
    	if ($get_post_tags) {
    	  foreach($get_post_tags as $tag) {
    		  $tag_list= [  $tag->name, get_tag_link( $tag->term_id ) ];
    		  array_splice( $crumbs, 2, 0, array($tag_list) );
    	  }
    	}
    	return $crumbs;
    }, 10, 2);

    Important Note: Please make sure you’ve choosen Category instead of Tags as your Primary Taxonomy by following the steps mentioned above.

    After applying the filter, your breadcrumbs should look like below:
    Home > Category > Tag(s) > Post title

    Here’s how you can add filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Daniel Braga
    Rank Math pro
    Content AI Starter Trial

    Thank you so much Sakib! It worked!!!

    Hello,

    You’re most welcome!

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘How to add Tag Pages in the breadcrumbs’ is closed to new replies.