-
Home
-
Locations and Areas – Leaflet Map with Region Tabs
- Tips
How to Hide Locations and Areas - Leaflet Map with Region Tabs Admin Menus
function plt_hide_locations_and_areas_menus() {
//Hide "Locations and Areas".
remove_menu_page('edit.php?post_type=laa-location');
//Hide "Locations and Areas → All locations".
remove_submenu_page('edit.php?post_type=laa-location', 'edit.php?post_type=laa-location');
//Hide "Locations and Areas → Add new location".
remove_submenu_page('edit.php?post_type=laa-location', 'post-new.php?post_type=laa-location');
//Hide "Locations and Areas → Areas".
remove_submenu_page('edit.php?post_type=laa-location', 'edit-tags.php?taxonomy=laa-area&post_type=laa-location');
//Hide "Settings → Locations and Areas".
remove_submenu_page('options-general.php', 'locations_and_areas');
//Hide "Settings → Upgrade".
remove_submenu_page('options-general.php', 'locations_and_areas-pricing');
}
add_action('admin_menu', 'plt_hide_locations_and_areas_menus', 1000000000);
Where do I put this code?
How to Hide the "Location" Meta Box
function plt_hide_locations_and_areas_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Location" meta box.
remove_meta_box('location_customfields', $screen->id, 'normal');
}
add_action('add_meta_boxes', 'plt_hide_locations_and_areas_metaboxes', 20);