Skip to content

Instantly share code, notes, and snippets.

@gr4y
Created August 5, 2010 18:55
Show Gist options
  • Select an option

  • Save gr4y/510195 to your computer and use it in GitHub Desktop.

Select an option

Save gr4y/510195 to your computer and use it in GitHub Desktop.
function the_category_filter($thelist,$separator=' ') {
$childrens = get_categories("child_of=".the_print_category_id());
$exclude=array();
$exclude[] = get_category(the_print_category_id())->name;
$exclude[] = get_category(the_special_category_id())->name;
foreach($childrens as $category){
$exclude[] = $category->name;
}
$cats = explode($separator,$thelist);
$newlist = array();
foreach($cats as $cat) {
$catname = trim(strip_tags($cat));
if(!in_array($catname,$exclude))
$newlist[] = $cat;
}
return implode($separator,$newlist);
}
add_filter('the_category','the_category_filter', 10, 2);
@gr4y
Copy link
Copy Markdown
Author

gr4y commented Aug 5, 2010

...

@gr4y
Copy link
Copy Markdown
Author

gr4y commented Aug 5, 2010

So it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment