I'm sorry for that question for which the answer is probably obvious... I don't know javascript, and usually i manage to kind of understand the codes i find here and to mix them, but this time I have difficulties to do it.

I want to hide some categories names from the category-list (entry-category) on the head of my posts. I found a code for that which works well (here, for instance, to hide the category 227) :

function the_category_filter($thelist,$separator=' ') {
    if(!defined('WP_ADMIN')) {
        //Category IDs to exclude
        $exclude = array(227);

        $exclude2 = array();
        foreach($exclude as $c) {
            $exclude2[] = get_cat_name($c);

        $cats = explode($separator,$thelist);
        $newlist = array();
        foreach($cats as $cat) {
            $catname = trim(strip_tags($cat));
                $newlist[] = $cat;
        return implode($separator,$newlist);
    } else {
        return $thelist;
add_filter('the_category','the_category_filter', 10, 2);

My problem is that i don't want to hide just one category, but all children categories of one specific parent category.

How can i do that ? If i put

array('parent' => 207)

(207 being the ID of the parent category) it doesn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.