Posted on

Menu and Sub menu Pages in Admin Panel

How to add menu and submenu in admin menus under admin dashboard

Given code to add menu and submenu in admin panel


Add menu page without creating any submenu or menu


Delete an Existing Sub-Menu

Finally, we may want to remove certain sub-menu elements. This may occur when we want to add a page but do not want it to be directly accessible from the main dashboard.
The function below allows us to remove a sub-menu based its unique menu-id and the unique submenu-id.

 $submenu_object) {
		if (in_array($submenu_name, $submenu_object)) {// remove menu object
			unset($submenu[$menu_name][$submenu_key]);
			return;
		}
	}           
}
// Add to end of admin_menu function        
remove_submenu('edit.php?post_type=theme', 'theme_options');
?>

Leave a Reply

Your email address will not be published. Required fields are marked *