Home › Forums › Calendar Products › Events Calendar PRO › Hide Event Category and Import sub menu items in admin
- This topic has 10 replies, 3 voices, and was last updated 8 years, 6 months ago by
Cliff.
-
AuthorPosts
-
October 19, 2017 at 11:06 am #1366101
Kyle Smiles
ParticipantI have tried to remove the Event Category and Import sub menu items in the admin using all of the suggestions on this forum and they don’t work. Please advise how to remove these. Here is my current code in functions.php
function l_remove_menus(){
remove_submenu_page(‘edit.php?post_type=tribe_events’, ‘tribe_events_cat&post_type=tribe_events’); // Event Category
remove_submenu_page(‘edit.php?post_type=tribe_events’, ‘edit.php?post_type=tribe_events&page=aggregator’); // Event Import
}
add_action( ‘admin_menu’, ‘l_remove_menus’, 999 );Thank you in advance.
October 20, 2017 at 11:02 am #1366719Cliff
MemberHi, Kyle.
If you want Event Categories fully removed, you would need to use https://developer.wordpress.org/reference/functions/unregister_taxonomy/
If you just want them hidden from the wp-admin sidebar menu and some other places, you could use the tribe_events_register_event_cat_type_args filter. For example, you might want to change “public” and/or “show_ui” from true to false.
Please let me know how this goes for you.
October 21, 2017 at 8:53 am #1367083Kyle Smiles
ParticipantI just want to hide, not remove, the ability for certain users to be able to add/edit Event Categories. So I just want to hide the menu options from them. I know how to do this by role, I just don’t see an easy way to do this. Looking at your post, I couldn’t find any documentation on the tribe_events_register_event_cat_type_args filter. How does it work? Do you have a link to the documentation? Thank you.
October 23, 2017 at 6:41 pm #1367819Cliff
MemberSorry, Kyle, but I’m confused by “want to hide, not remove, the ability for certain users” and then by “I know how to do this by role”
Would you mind clarifying?
October 24, 2017 at 9:57 am #1368210Kyle Smiles
ParticipantI want to have the submenu items “Event Category” and “Import” removed from the admin page and the following isn’t working:
remove_submenu_page(‘edit.php?post_type=tribe_events’, ‘edit-tags.php?taxonomy=tribe_events_cat&post_type=tribe_events’); // Event Category
remove_submenu_page(‘edit.php?post_type=tribe_events’, ‘edit.php?post_type=tribe_events&page=aggregator’); // Event ImportOctober 24, 2017 at 10:46 am #1368242Cliff
MemberFor everyone (including Admins) or just certain users / user levels?
October 24, 2017 at 10:54 am #1368249Kyle Smiles
ParticipantFor certain User Levels (i.e. Subscriber).
October 24, 2017 at 6:48 pm #1368406Cliff
MemberPlease try this:
https://gist.github.com/cliffordp/d7fd672cd5c003335415ffc0451116fa
Note that it won’t remove the Event Categories metabox from the wp-admin event edit screen.
You’ll also need to modify the current_user_can() to be what you need it to be.
Additionally, please note that, per our Scope of Support / Terms, we don’t normally provide customizations like this, but I was happy to help you on the way to your final solution.
October 25, 2017 at 6:42 am #1368594Kyle Smiles
ParticipantThat’s what I needed. Thank you Cliff!
October 25, 2017 at 10:58 am #1368809Cliff
MemberYou’re very welcome! 🙂
-
AuthorPosts
- The topic ‘Hide Event Category and Import sub menu items in admin’ is closed to new replies.
