Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active October 25, 2017 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cliffordp/d7fd672cd5c003335415ffc0451116fa to your computer and use it in GitHub Desktop.
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.
<?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&amp;post_type=tribe_events' // must be &amp;
);
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