Title: [Plugin: Yoast Breadcrumbs] Exclude categories?
Last modified: August 19, 2016

---

# [Plugin: Yoast Breadcrumbs] Exclude categories?

 *  [rhythmdoctor](https://wordpress.org/support/users/rhythmdoctor/)
 * (@rhythmdoctor)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/plugin-yoast-breadcrumbs-exclude-categories/)
 * Yoast,
 * I tried to figure out how to do this on my own but couldnt.
 * Is there a way to exclude specific categories in any way. Because I have a featured
   category, and it appears that your plugin chooses categories alphabetically, 
   all posts in this category show that category where as Id prefer they were to
   display their more related category.

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

 *  [johnandrews](https://wordpress.org/support/users/johnandrews/)
 * (@johnandrews)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/plugin-yoast-breadcrumbs-exclude-categories/#post-1169656)
 * @rythmdoctor, I also needed this functionality. I had already written a function
   to remove unwanted categories from any get_the_category result, so I was able
   to add just one line to Yoast’s plugin.
 * Put the following code in your functions.php. Change 30,31,32 to the ID(s) you
   wish to exclude.
 *     ```
       function get_the_category_exclusions($categories) {
       	$args = array(
       		'categories' => $categories,
       		'exclude'    => '30,31,32'
       	);
       	return exclude_categories($args);
       }
   
       function exclude_categories($args) {
       	$count = 0;
       	foreach ($args['categories'] as $category) {
       		if(strpos($args['exclude'],$category->cat_ID)){
       			unset($args['categories'][$count]);
       		}
       		$count++;
       	}
       	$categories = $args['categories'];
       	return array_values($categories);
       }
       ```
   
 * Then on yoast-breadcrumbs.php add the following after $cats = get_the_category();(
   approx line:232).
 *     ```
       $cats = get_the_category_exclusions($cats);
       ```
   
 * This solution is tested and working for WP v2.8.4 Plugin v0.8.4
 *  [SauloB](https://wordpress.org/support/users/saulob/)
 * (@saulob)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/plugin-yoast-breadcrumbs-exclude-categories/#post-1169662)
 * john.andrews, thank you very much for this function.
 * Worked fine for my site 🙂
 * Thanks.
 *  [SauloB](https://wordpress.org/support/users/saulob/)
 * (@saulob)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/plugin-yoast-breadcrumbs-exclude-categories/#post-1169663)
 * Ok, it’s not working right.
 * I choose to exclude the category id ’50’, but it excludes the ’50’ and ‘5’ too
   🙁
 * Any help?

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

The topic ‘[Plugin: Yoast Breadcrumbs] Exclude categories?’ is closed to new replies.

## Tags

 * [Yoast](https://wordpress.org/support/topic-tag/yoast/)
 * [Yoast Breadcrumbs](https://wordpress.org/support/topic-tag/yoast-breadcrumbs/)

 * 3 replies
 * 3 participants
 * Last reply from: [SauloB](https://wordpress.org/support/users/saulob/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/plugin-yoast-breadcrumbs-exclude-categories/#post-1169663)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
