Tips on Customizing Login as User

How to Hide the "Login as User" Admin Menu

function plt_hide_login_as_user_menus() {
	//Hide the "Settings → Login as User" menu.
	remove_submenu_page('options-general.php', 'login-as-user');

add_action('admin_menu', 'plt_hide_login_as_user_menus', 11);

Where do I put this code?

How to Hide the "Login as User" Meta Box

function plt_hide_login_as_user_metaboxes() {
	$screen = get_current_screen();
	if ( !$screen ) {

	//Hide the "Login as User" meta box.
	remove_meta_box('login_as_user_metabox', $screen->id, 'side');

add_action('add_meta_boxes', 'plt_hide_login_as_user_metaboxes', 20);