The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Yoast SEO
Exclude category from breadcrumbs? (7 posts)

  1. jenseo
    Posted 2 years ago #

    I recently migrated from All in one SEO to WordPress SEO and first of all I just want to ask you for an amazing plugin, it does pretty much everything and I just love that!

    Now to my question:

    I have a featured category on my blog, where I'm adding posts to be displayed on certain areas of the blog, but this category name is never displayed in the blog. I have filtered it out.

    My problem is that this category is still showing up in the breadcrumbs. Is there a way to filter it out there as well, making it invisible to my visitors?

    To be clear: Most post of my blog only excists in one category, but featured posts always is added to two categories. But, the featured name shouldn't be seen on the front end of the site...

    Thanks again for a wonderful plugin!

    // Jens.


  2. jrf
    Posted 2 years ago #

    There are filters available for that. Have a look at this thread: http://wordpress.org/support/topic/how-do-i-remove-cpt-from-breadcrumb-trail

  3. jenseo
    Posted 2 years ago #

    Thanks jrf, looks to be what I need!

    I'm not really sure how to solve the following scenario though:

    If I base my filter on the example in the thread you linked, I'm guessing that it will remove the category I specify, but I would also like it to choose the other category from the post.

    Any suggestion how I can apply this in a filter?


    // Jens.

  4. jrf
    Posted 2 years ago #

    In your case I'd use the other filter and code along the lines of:

    add_filter( 'wpseo_breadcrumb_links', 'my_breadcrumb_filter_function' );
    function my_breadcrumb_filter_function( $crumbs ) {
    	/* Do something, for instance:
    	   - test the crumb for the featured category & replace it with another, i.e.:
    	foreach( $crumbs as $i => $crumb ) {
    		// Test for the unwanted crumb - replace ## with your term id
    		if( isset( $crumb['term'] ) && $crumb['term'] == ## && isset( $GLOBALS['post'] ) {
    			// Add some arguments to get your term
    			$terms = wp_get_object_terms( $GLOBALS['post']->ID, 'category', $args );
    			if( ! is_wp_error( $terms ) ) {
    				// -> Do something to get your preferred term from the $terms array
    				$myterm = ....;
    				$crumbs[$i] = array(
    					'term' => $mytermid,
    	return $crumbs;
  5. jenseo
    Posted 2 years ago #

    Awesome, I'll give it a spin! Thanks a lot!

  6. jrf
    Posted 2 years ago #

    Good luck. Could you mark this topic as resolved ?

  7. scifenefics
    Posted 2 years ago #

    I had this same problem and solved it by hiding it with this CSS

    #breadcrumbs span:nth-child(2) a {

    I wanted my sites breadcrumbs to flow like:
    Home > Businesses > Restaurants > Greasy Joes

    But my theme (Geocraft) pulled up a surprise and gave me:
    Home > Business Listings > Businesses > Restaurants > Greasy Joes

    Since "Business Listings" is 2nd in the list, this CSS looks within the "#breadcrumbs" tag then in the "spans" then the second child in the list "(2)" and finally the link "a" and I made it hidden.

    Worked well for me. Yoast WordPress SEO

Topic Closed

This topic has been closed to new replies.

About this Plugin

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

About this Topic