This is the first part of wordpress customization series. In this tutorial i will discus about removing menu from wordpress dashboard. Removing a menu from dashboard doesn’t means that the menu has removed forever but it is just hide from admin screen.
WordPress is a very popular cms (Content Management System) that provide us a very usual and easy back end environment. It is provide most of the things you needed to manage yor website application.
How to remove wordpress menu page from admin dashboard ?
A wordpress admin’s top level menu can be remove by calling a custom function into admin_menu action hook.
<?php function remove_admin_menu_page() { remove_menu_page( $menu_slug ); } add_action( 'admin_menu', 'remove_admin_menu_page' ); ?>
In the above example remove_admin_menu_page() is a custom function which is calling in admin_menu action hook. This function contains the remove_menu_page().
-
remove_menu_page($menu_slug)
remove_menu_page() function received a required parameter $menu_slug that is the slug of menu page which is going to remove.
Examples
<?php function custom_remove_menus(){ remove_menu_page( 'index.php' ); //Dashboard remove_menu_page( 'jetpack' ); //Jetpack* remove_menu_page( 'edit.php' ); //Posts remove_menu_page( 'upload.php' ); //Media remove_menu_page( 'edit.php?post_type=page' ); //Pages remove_menu_page( 'edit-comments.php' ); //Comments remove_menu_page( 'themes.php' ); //Appearance remove_menu_page( 'plugins.php' ); //Plugins remove_menu_page( 'users.php' ); //Users remove_menu_page( 'tools.php' ); //Tools remove_menu_page( 'options-general.php' ); //Settings } add_action( 'admin_menu', 'custom_remove_menus' ); ?>
The above example shows how can we remove different menus from admin dashboard screen.
Also see what are wordpress hooks and filters ?
WordPress customization part 2 – Renaming dashboard menus
Hope guys it will help you to customize wordpress and our series to customize wordpress is continue. Keep visiting our blog and please share your views on comment box.