Only one category and subcategories in admin area
-
function exclude_cats() { if( !current_user_can('manage_options') ) { add_filter( 'list_terms_exclusions', 'exclude_args', 10, 2 ); } } function exclude_args($exclusions,$args) { $current_user = wp_get_current_user(); if (strpos($current_user->adi_title, 'Support') !== false) { $showcat = 26; } elseif (strpos($current_user->adi_title, 'Sales') !== false) { $showcat = 27; } return $exclusions . " AND ( t.term_id = " . $showcat . " )"; } add_action( 'admin_init', 'exclude_cats' );
I’ve got this code working for only showing the category the user is supposed to see/work with.
But I want the subcategories to be shown too. Any ideas?
Also, does this mean that whenever a contributor, that only sees/works with different categories, sends a post for approval – does that post show up for all editors or does it just show for those editors that can see the specific category (as in this code)?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Only one category and subcategories in admin area’ is closed to new replies.