Restrict admin pages for specific user role

You can use the remove_menu_page() hook to remove the menu items, but the pages will still be accessible if the user types in the URL. Source: WPMayor

To find the ‘contact’ page to remove, grab the slug from the Contact admin page and paste it as the argument as the argument, e.g. remove_menu_page( "[Your admin page's slug]" ). The following ones are also slugs I believe:

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

  global $user_ID;

  if ( current_user_can( 'advertiser' ) ) {
    remove_menu_page('tools.php'); // Tools
    remove_menu_page('edit.php'); // Posts
    remove_menu_page('edit-comments.php'); // Comments 
  }
}

tech