Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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

share|improve this answer
up vote 0 down vote accepted

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');
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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