Created
July 17, 2014 15:43
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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