Last active
October 25, 2017 01:48
-
-
Save cliffordp/d7fd672cd5c003335415ffc0451116fa to your computer and use it in GitHub Desktop.
The Events Calendar: Remove the "Event Categories", "Import", and "Legacy Import" submenu items from the wp-admin > Events menu if logged-in user is an Editor or lower.
This file contains 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
<?php | |
/** | |
* The Events Calendar: Remove the "Event Categories", "Import", and "Legacy | |
* Import" submenu items from the wp-admin > Events menu if logged-in user | |
* is an Editor or lower. | |
* | |
* @link https://gist.github.com/cliffordp/d7fd672cd5c003335415ffc0451116fa | |
* @link https://theeventscalendar.com/support/forums/topic/hide-event-category-and-import-sub-menu-items-in-admin/#post-1368406 | |
* @link https://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table | |
*/ | |
add_action( 'admin_menu', 'cliff_remove_events_submenu_items_for_kyle_1366101', 100 ); | |
function cliff_remove_events_submenu_items_for_kyle_1366101() { | |
if ( ! current_user_can( 'edit_pages' ) ) { | |
remove_submenu_page( | |
'edit.php?post_type=tribe_events', | |
'edit-tags.php?taxonomy=tribe_events_cat&post_type=tribe_events' // must be & | |
); | |
remove_submenu_page( | |
'edit.php?post_type=tribe_events', | |
'aggregator' | |
); | |
remove_submenu_page( | |
'edit.php?post_type=tribe_events', | |
'events-importer' | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment