How to hide menu on WordPress admin

You can do this with remove_menu_page. Add the appropriate menu slug in your functions.php of your theme or your plugin.

<?php remove_menu_page( $menu_slug ) ?>

Note that users can still access these menus using a direct link. If you intend to block a user from accessing a menu, you will have to set up a user role and make sure they don’t have the relevant capabilities.

Here is a list of slug examples for the menus included in a clean WordPress install.

<?php
function remove_menus(){  

  remove_menu_page( 'index.php' );                  //Dashboard  
  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', 'remove_menus' );  
?>

Leave a Comment