Exclude category from the_category
-
Hello
I want to exclude one special category from the_category tag.I use this code but the problem is that this code remove that special category with their child’s but i want to only remove on category.function the_category_filter($thelist,$separator=' ') { if(!defined('WP_ADMIN')) { //list the category names to exclude $exclude = array('Something','Something Else','Blah','YAY'); $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); } else return $thelist; } add_filter('the_category','the_category_filter',10,2);i get this code from this topic.
The topic ‘Exclude category from the_category’ is closed to new replies.