Skip to content

Instantly share code, notes, and snippets.

@raideus
Created May 22, 2012 22:54
Show Gist options
  • Save raideus/2772131 to your computer and use it in GitHub Desktop.
Save raideus/2772131 to your computer and use it in GitHub Desktop.
Remove Unwanted Menu Items from the WordPress Dashboard
<?php
/* --------------------------------------------------------------------
Remove Unwanted Menu Items from the WordPress Dashboard
- Requires WordPress 3.1+
-------------------------------------------------------------------- */
function sb_remove_admin_menus (){
// Check that the built-in WordPress function remove_menu_page() exists in the current installation
if ( function_exists('remove_menu_page') ) {
/* Remove unwanted menu items by passing their slug to the remove_menu_item() function.
You can comment out the items you want to keep. */
remove_menu_page('index.php'); // Dashboard tab
remove_menu_page('edit.php'); // Posts
remove_menu_page('edit.php?post_type=page'); // Pages
remove_menu_page('upload.php'); // Media
remove_menu_page('link-manager.php'); // Links
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 our function to the admin_menu action
add_action('admin_menu', 'sb_remove_admin_menus');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment