With Following im able to remove the menu if user role is not administrator
add_action('admin_menu', function () {
if(!current_user_can('administrator')) {
remove_menu_page('edit-comments.php');
remove_menu_page('options-general.php');
remove_menu_page('users.php');
remove_menu_page('tools.php');
remove_menu_page('edit.php?post_type=acf-field-group');
remove_menu_page('plugins.php');
remove_menu_page('update-core.php');
}
});
but what i want is, one admin (like super-admin) having full access to the site and second admin with some limitation like i want remove plugin menu for 2nd admin and give rest access
//2nd admin can be user name or user id
add_action('admin_menu', function () {
if(current_user_can('administrator' === '2nd admin')) {
remove_menu_page('users.php');
remove_menu_page('tools.php');
remove_menu_page('plugins.php');
}
});
how can i control / limit few feature for 2nd admin…
or should i create custom role… for the feature i wanted…