Wordpress - How can I hide a category from Contributors in the edit/add new post screen?

Hi @davemac:

Well, I wrote this before I saw that you answered your own question so I might as well post it anyway:

add_filter('list_terms_exclusions', 'yoursite_list_terms_exclusions', 10, 2);
function yoursite_list_terms_exclusions( $exclusions, $args ) {
  global $pagenow;
  if (in_array($pagenow,array('post.php','post-new.php')) && 
     !current_user_can('see_special_cats')) {
    $exclusions = " {$exclusions} AND t.slug NOT IN ('slug-one','slug-two')";
  }
  return $exclusions;
}

This code presumes that you've used a plugin like the Members plugin to create a capability called 'see_special_cats' and that you've assigned it to every role that you want to have access to the categories except of course 'Contributors'.

Since you found the plugin you may not need this, but maybe it will help someone else.