Remove menus from WordPress dashboard
If you don’t want to show some menus to your client or some user then you need to remove menus from the WordPress dashboard. Same as the point of hiding dashboard menus in WordPress. The following codes tested under WordPress 3.8.1
Step 1:
Open the function.php file which sitting in your active theme directory. Paste the following codes.
add_action("admin_menu", "remove_menus", 9999);
function remove_menus()
{
remove_menu_page( "edit.php" ); // Posts
remove_menu_page( "upload.php" ); // Media
remove_menu_page( "edit-comments.php" ); // Comments
remove_menu_page( "edit.php?post_type=page" ); // Pages
remove_menu_page( "plugins.php" ); // Plugins
remove_menu_page( "users.php" ); // Users
remove_submenu_page ( "index.php", "update-core.php" ); //Dashboard->Updates
remove_menu_page( "tools.php" ); // Tools
remove_menu_page( "themes.php" ); // Appearance
//remove_submenu_page ( "themes.php", "themes.php" ); // Appearance>Themes
//remove_submenu_page ( "themes.php", "widgets.php" ); // Appearance>Widgets
//remove_submenu_page ( "themes.php", "theme-editor.php" ); // Appearance>Editor
//remove_menu_page( "options-general.php" ); // Settings
remove_submenu_page( "options-general.php", "options-general.php" ); // Settings->General
remove_submenu_page( "options-general.php", "options-writing.php" ); // Settings->writing
remove_submenu_page( "options-general.php", "options-reading.php" ); // Settings->Reading
remove_submenu_page( "options-general.php", "options-discussion.php" ); // Settings->Discussion
remove_submenu_page( "options-general.php", "options-media.php" ); // Settings->Media
remove_submenu_page( "options-general.php", "options-privacy.php" ); // Settings->Privacy
remove_submenu_page( "options-general.php", "options-permalink.php" ); // Settings->Privacy
remove_menu_page( "gf_edit_forms" ); // Forms
}
Step 2:
If you want to remove menus that added by some plugin like GvityForm you then you need do as the following.
First, click the menu you want to remove and see what is the URL in your browser. If the URL looks like http://YOURDOMAIN-WORDPRESS-SITE/wp-admin/admin.php?page=gf_edit_forms then you need a copy gf_edit_forms .
Second, add the following codes in your function.php.
add_action("admin_menu", "remove_menus", 9999);
function remove_menus()
{
remove_menu_page( "gf_edit_forms" ); // Forms, the parameter is what you copied from the menu's URL.
}
Step 3:
Some plugin adds menus to option page such as Settings–>XML Sitemaps. To remove these menus, save as above you need to copy the page value in the menus’ URL.
Here is a sample for removing the menu of Google XML Sitemaps. http://YOURDOMAIN-WORDPRESS-SITE/wp-admin/options-general.php?page=google-sitemap-generator/sitemap.php
add_action("admin_menu", "remove_menus", 9999);
function remove_menus()
{
remove_submenu_page( "options-general.php", "google-sitemap-generator/sitemap.php" ); // Google XML Sitemaps
}

Post a Comment