Remove menu item dashboard for a unique user

I want to disable access to some pages like “Themes” or “Plugins” for my client (just his ID) and try to do it in the functions.php with this script:

$current_user_id = wp_get_current_user();
if ( $current_user_id === 2 ) {
function remove_menus(){
remove_menu_page( ‘themes.php’ ); //Appearance
remove_menu_page( ‘plugins.php’ ); //Plugins
}
add_action( ‘admin_menu’, ‘remove_menus’ );
}

The user’s ID is 2 so I don’t understand why it’s not working? Any idea?
Thanks

Read more here:: Remove menu item dashboard for a unique user

Leave a Reply

Your email address will not be published. Required fields are marked *