Some time it’s necessary to hide some menu item from wordpress admin sidebar menu. Here we will learn How to Hide Unnecessary Items From WordPress Admin. Just put the below function in your function.php file and replace the file url with your desired url.

function codecanal_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', 'codecanal_remove_menus' );

To Remove Sub menu Page

add_action( 'admin_menu', 'codecanal_adjust_the_wp_menu', 999 );
function codecanal_adjust_the_wp_menu() {
  $page = remove_submenu_page( 'themes.php', 'widgets.php' );
}

Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user’s permissions as appropriate.

  • Ashish Sharma

    Hey Guys, you are doing great job. The ways you are explaining the solution of the issues are really good.
    Keep it up 🙂