Hide WordPress backend menu items

To make the backend as clear as possible for customers, it is useful to hide menu items that are not used by code. This snippet goes as almost always in the functions.php of the current WordPress theme:

/** hide menu items */

function jado_hide_menus()
    global $menu;
    //$restricted = array(__('Posts'), __('Links'), __('Media'), __('Comments'), __('Pages'), __('Tools'), __('Plugins'));
    $restricted = array(__('Links'), __('Comments'), __('Tools'));
    while (prev($menu)) {
        $value = explode(' ', $menu[key($menu)][0]);
        if (in_array($value[0] != null ? $value[0] : "", $restricted)) {
add_action('admin_menu', 'jado_hide_menus');

For example, a WordPress backend could then look like this: