Friday, June 7, 2019

Remove Menu From Wordpress Admin

add_action('admin_init', 'remove_menu_from_admin');

function remove_menu_from_admin()

    // Remove unnecessary menus
    $menus_to_stay = array(
        // Job Listing
        'edit.php?post_type=job_listing',
    );
    foreach ($GLOBALS['menu'] as $key => $value) {         
        if (!in_array($value[2], $menus_to_stay)) remove_menu_page($value[2]);
    }
}

No comments:

Post a Comment