Deactivate Bookings

This topic contains 5 replies, has 2 voices, and was last updated by  Clifford P 9 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16685

    Is there a way to deactivate / hide / remove the Bookings options from wp-admin?

    Clifford P
    #16694

    Hi Clifford,

    The following does this (the examples as written here require PHP 5.3 because of the use of anonymous functions):

    //Removes bookings page
    add_action( 'admin_menu', function(){
        remove_submenu_page( 'edit.php?post_type=event', 'bookings' );
    }, 20 );
    
    //Removes tickets meta box
    add_action( 'add_meta_boxes_event', function(){
        remove_meta_box( 'eventorganiser_tickets', 'event', 'normal' );
    }, 20 );
    
    Stephen Harris
    #16710

    Didn’t work.

    I tried in my functionality plugin then in my active theme’s functions.php.

    I have PHP v5.5

    Clifford P
    #16711

    My mistake. For some reason it now works to make Events -> Bookings submenu page removed from the wp-admin menu (/wp-admin/edit.php?post_type=event&page=bookings) and the Event Tickets metabox go away from the Event post type wp-admin page.

    However, Settings -> Event Organiser -> “Bookings” (/wp-admin/options-general.php?page=event-settings&tab=bookings) and “Booking Form” (/wp-admin/options-general.php?page=event-settings&tab=booking-form) tabs still appear.

    Is there a way to remove those as well?

    Clifford P
    #16718

    Yup:

    add_filter( 'eventorganiser_settings_tabs',function( $tabs ){
        unset( $tabs['bookings'] );
        unset( $tabs['booking-form'] );
        return $tabs;
    }, 20 );
    
    Stephen Harris
    #16732

    Works. tyvm.

    Maybe consider adding a checkbox in EO settings to “turn off all Bookings options” if won’t be using it.

    Clifford P
Viewing 6 posts - 1 through 6 (of 6 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.