1

How can i programatically change the Category selection menu on wp-admin? is there a hook or filter to edit the Category List?

My objective is to filter out specific categories for specific post-types, for example:

I have the categories: Sports,Players and Coaches

under the post-types: People and Activities

I want to filter the Sports Category out of the People Post-type.

2 Answers 2

1

I went down the rabbit hole with this a few weeks ago. Never quite got it working right.

These might lead you in the right direction:

http://shibashake.com/wordpress-theme/add-custom-post-type-columns

http://wordpress.org/support/topic/category-column-for-custom-post-types?replies=3

0

i found the get_terms filter, that seemed to work fine for me:

  function filterCats($listCats){
    global $typenow;    
    if($typenow=='People'){
        foreach ($listCats as $k => $oCat) {
            if( $oCat->term_id == 6){//Sports Category id
                unset($listCats[$k]);
            }
        }
     }
     return $listCats;
 }
 add_filter('get_terms','filterCats');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.