-
Home
-
CommonsBooking
- Tips
How to Hide Commons Booking Admin Menus
function plt_hide_commonsbooking_menus() {
//Hide "Settings → CommonsBooking".
remove_submenu_page('options-general.php', 'commonsbooking_options');
//Hide "Commons Booking".
remove_menu_page('cb-dashboard');
//Hide "Commons Booking → Dashboard".
remove_submenu_page('cb-dashboard', 'cb-dashboard');
//Hide "Commons Booking → Timeframes".
remove_submenu_page('cb-dashboard', 'edit.php?post_type=cb_timeframe');
//Hide "Commons Booking → Items".
remove_submenu_page('cb-dashboard', 'edit.php?post_type=cb_item');
//Hide "Commons Booking → Locations".
remove_submenu_page('cb-dashboard', 'edit.php?post_type=cb_location');
//Hide "Commons Booking → Bookings".
remove_submenu_page('cb-dashboard', 'edit.php?post_type=cb_booking');
//Hide "Commons Booking → Maps".
remove_submenu_page('cb-dashboard', 'edit.php?post_type=cb_map');
//Hide "Commons Booking → Restrictions".
remove_submenu_page('cb-dashboard', 'edit.php?post_type=cb_restriction');
//Hide "Commons Booking → Item Categories".
remove_submenu_page('cb-dashboard', 'http://127.0.0.1/wp-admin/edit-tags.php?taxonomy=cb_items_category');
//Hide "Commons Booking → Location Categories".
remove_submenu_page('cb-dashboard', 'http://127.0.0.1/wp-admin/edit-tags.php?taxonomy=cb_locations_category');
//Hide "Commons Booking → Mass Operations".
remove_submenu_page('cb-dashboard', 'cb-mass-operations');
}
add_action('admin_menu', 'plt_hide_commonsbooking_menus', 11);
Where do I put this code?
How to Hide Commons Booking Meta Boxes
function plt_hide_commonsbooking_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Item Info" meta box.
remove_meta_box('_cb_item_info', $screen->id, 'normal');
//Hide the "Address" meta box.
remove_meta_box('_cb_location_adress', $screen->id, 'normal');
//Hide the "General Location information" meta box.
remove_meta_box('_cb_location_info', $screen->id, 'normal');
//Hide the "Timeframe" meta box.
remove_meta_box('cb_timeframe-custom-fields', $screen->id, 'normal');
//Hide the "Map settings" meta box.
remove_meta_box('cb_map-custom-fields', $screen->id, 'normal');
//Hide the "Booking" meta box.
remove_meta_box('cb_booking-custom-fields', $screen->id, 'normal');
//Hide the "Restriction" meta box.
remove_meta_box('cb_restriction-custom-fields', $screen->id, 'normal');
}
add_action('add_meta_boxes', 'plt_hide_commonsbooking_metaboxes', 20);