• Hi!
    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.

    https://www.ads-software.com/plugins/wordpress-seo/

Viewing 6 replies - 1 through 6 (of 6 total)
  • There are filters available for that. Have a look at this thread: https://www.ads-software.com/support/topic/how-do-i-remove-cpt-from-breadcrumb-trail

    Thread Starter jenseo

    (@jenseo)

    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?

    Thanks!

    // Jens.

    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;
    }
    Thread Starter jenseo

    (@jenseo)

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

    Good luck. Could you mark this topic as resolved ?

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

    #breadcrumbs span:nth-child(2) a {
    display:none;
    }

    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 1.5.2.7

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Exclude category from breadcrumbs?’ is closed to new replies.