disable Tag meta box on the backend

Home Forums Calendar Products Events Calendar PRO disable Tag meta box on the backend

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1525341
    Boris
    Participant

    I’m trying to hide the Tag meta box from view for anyone making a new event from the admin panel.

    To remove the metabox, I have the following code at the bottom of my functions.php file:

    add_action( 'admin_menu', 'remove_backend_meta_box');
    function remove_backend_meta_box() {
    remove_meta_box ( 'tagsdiv-post_tag', 'post', 'side');
    }

    sources I’ve looked at:
    https://codex.wordpress.org/Function_Reference/remove_meta_box
    https://stackoverflow.com/questions/35113196/remove-metabox-from-custom-post-editor
    https://wordpress.stackexchange.com/questions/240836/hiding-a-themes-meta-box
    https://tommcfarlin.com/remove-wordpress-meta-boxes/

    To remove the link in the admin panel to edit tags, I am using the following at the bottom of my functions.php file:

    add_action('admin_menu', 'my_remove_sub_menus');
    function my_remove_sub_menus() {
        remove_submenu_page('edit.php?post_type=tribe_events', 'edit-tags.php?taxonomy=post_tag&post_type=tribe_events');
    }

    Sources:
    https://codex.wordpress.org/Function_Reference/remove_submenu_page
    https://wordpress.stackexchange.com/questions/110782/remove-categories-tags-from-admin-menu/236211

    Neither one seems to be doing the trick.

    #1526159
    Sky
    Keymaster

    Hi there!

    Thanks for reaching out. I will try to help figure out how to do this.

    It looks like you were close! Here is a snippet for removing the metabox:


    add_action( 'admin_menu', 'tft_remove_taxonomy_metabox', 999);
    function tft_remove_taxonomy_metabox() {
    remove_meta_box('tagsdiv-post_tag', 'tribe_events', 'side');
    }

    and for removing the menu item:


    add_action('admin_menu', 'my_remove_sub_menus', 999);
    function my_remove_sub_menus() {
    remove_submenu_page( 'edit.php?post_type=tribe_events', 'edit-tags.php?taxonomy=post_tag&post_type=tribe_events' );
    }

    Let me know if that works for you!

    Thanks,
    Sky

    #1526249
    Boris
    Participant

    Thanks! Removing the Tag metabox works. Putting in the appropriate execution time did the trick.

    This solution was hinted at in the Notes section of https://codex.wordpress.org/Function_Reference/remove_meta_box but gave no obvious recommendation.

    However, removing the Events/Tags submenu still doesn’t work.

    I tested to see if I could remove other items. I was able to remove Events/Venues and the default Post/Tags submenu items in the code below:

    add_action('admin_menu', 'my_remove_sub_menus', 999);
    function my_remove_sub_menus() {
        remove_submenu_page( 'edit.php?post_type=tribe_events', 'taxonomy=post_tag&post_type=tribe_events' ); //no luck
        remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' ); //works
        remove_submenu_page( 'edit.php?post_type=tribe_events', 'edit.php?post_type=tribe_venue'); //also works
    }
    #1527153
    Sky
    Keymaster

    I see what’s happening. The ‘&’ in the url needs to be an html entity, but the editor here is automatically converting it.

    You need to add ‘amp;’ on to the end of the ‘&’.

    This goes in between “taxonomy=post_tag” and “post_type=tribe_events”

    Let me know if that helps.

    Thanks,
    Sky

    #1527170
    Boris
    Participant

    Yep! That works. Many thanks.

    #1527174
    Sky
    Keymaster

    Awesome!

    Glad it worked for you.

    Let us know if you have any questions or issues in the future.

    Thanks,
    Sky

    #1543979
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘disable Tag meta box on the backend’ is closed to new replies.