Answers for "how to bound admin user to show selected menu on backend"

PHP
0

how to bound admin user to show selected menu on backend

add_action( 'admin_init', 'my_remove_menu_pages' );
function my_remove_menu_pages() {


  global $user_ID;

  if ( $user_ID == 3 ) { //select your user id

   remove_menu_page('edit.php'); // Posts
   remove_menu_page('upload.php'); // Media
   remove_menu_page('link-manager.php'); // Links
   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('themes.php'); // Appearance
   remove_menu_page('users.php'); // Users
   remove_menu_page('tools.php'); // Tools
   remove_menu_page('options-general.php'); // Settings
   remove_menu_page('edit.php'); // Posts
   remove_menu_page('upload.php'); // Media
   remove_menu_page( 'admin_custom_login' );//plugin
	  
 remove_menu_page( 'edit.php?post_type=project' );//project cpt
  }
}
Posted by: Guest on July-30-2021

Code answers related to "how to bound admin user to show selected menu on backend"

Browse Popular Code Answers by Language