how do you prevent showing a particular category on the admin dashboard for specific user roles?

I’d like to prevent the “Featured” category from appearing for certain user roles. To be specific, I want only the admins and editors to be able to see and thus select or unselect that category. Everybody else can see the whole tree but the Featured cat.

Which hooks and WP API do I need to tap into in writing the necessary plug in?

Related posts

Leave a Reply

2 comments

  1. Based on the first Answer from Mike Schinkel. For testing purposes in a default installation, the category is “Uncategorized”.

    add_filter( 'list_terms_exclusions', 'wpse_59652_list_terms_exclusions', 10, 2 );
    
    function wpse_59652_list_terms_exclusions( $exclusions, $args ) 
    {
        global $current_screen;
    
        if( 'post' != $current_screen->post_type )
            return $exclusions;
    
        if( !current_user_can('delete_others_pages') )
            return $exclusions;
    
        return $exclusions . " AND ( t.name <> 'Uncategorized' )"; 
    }