Remove admin menu from WordPress dashboard

 
add_action('admin_init', 'custom_remove_admin_page');

if(!function_exists('custom_remove_admin_page')) {
	function remove_admin_page($needle) {
		if(isset($GLOBALS[ 'menu' ]) && !empty($GLOBALS[ 'menu' ]) && !empty($needle)) {
			$needle = strtolower($needle);
			$needle = trim($needle);
			foreach($GLOBALS[ 'menu' ] as $position => $items) {
				foreach($items as $key => $item) {                   
					if(strtolower($item) == $needle) {
						remove_menu_page( $items[2] );
					}
				}
			}
		}
	}
}