Hide Event Category and Import sub menu items in admin

Home Forums Calendar Products Events Calendar PRO Hide Event Category and Import sub menu items in admin

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1366101
    Kyle Smiles
    Participant

    I 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.

    #1366719
    Cliff
    Member

    Hi, 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.

    #1367083
    Kyle Smiles
    Participant

    I 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.

    #1367819
    Cliff
    Member

    Sorry, 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?

    #1368210
    Kyle Smiles
    Participant

    I 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 Import

    #1368242
    Cliff
    Member

    For everyone (including Admins) or just certain users / user levels?

    #1368249
    Kyle Smiles
    Participant

    For certain User Levels (i.e. Subscriber).

    #1368406
    Cliff
    Member

    Please 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.

    #1368594
    Kyle Smiles
    Participant

    That’s what I needed. Thank you Cliff!

    #1368809
    Cliff
    Member

    You’re very welcome! 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Hide Event Category and Import sub menu items in admin’ is closed to new replies.