Skip to content

Instantly share code, notes, and snippets.

@ckpicker
Created July 17, 2014 15:43
Show Gist options
  • Save ckpicker/472fbe0c96e209d2bf0d to your computer and use it in GitHub Desktop.
Save ckpicker/472fbe0c96e209d2bf0d to your computer and use it in GitHub Desktop.
Community Events 3.6 // Remove Specified Categories from Submission Screen for non-admins
add_filter( 'tribe_community_events_event_categories', 'hide_category_for_non_admins', 10, 2);
function hide_category_for_non_admins( $categories ) {
//Array of Category slugs to hide for non-admins
$categories_to_hide = array( 'concert', 'convention' );
//If user is not admin
if( !current_user_can( 'manage_options' ) ) {
foreach( $categories as $key => $single_cat ) {
if( in_array( $single_cat->slug, $categories_to_hide ) ) {
//Remove the item if it exists
unset( $categories[$key] );
}
}
}
return $categories;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment