I've got 3 admin users and would like to modify admin menu for 2 of them by their email address, not by role (since the capabilities are all the same).
This works with a single email address:
add_action('admin_menu', 'remove_admin_menu_links');
function remove_admin_menu_links(){
$user = wp_get_current_user();
if( $user && isset($user->user_email) && '[email protected]' == $user->user_email ) {
remove_menu_page('tools.php');
remove_menu_page('themes.php');
remove_menu_page('options-general.php');
remove_menu_page('plugins.php');
}
}
What's the proper syntax for listing an array of email addresses?
I've tried the option below. It does nothing at all, stops working but no error either.
if( $user && isset($user->user_email) && (in__array('[email protected]','[email protected]')) == $user->user_email ) {
in_array
is with 1 underscore and works like that : php.net/in_array