Remove tabs from media uploader for a CPT

You can use the media_upload_tabs filter check for your post type and unset any tab you don’t want ex:

function remove_media_library_tab($tabs) {
    if (isset($_REQUEST['post_id'])) {
        $post_type = get_post_type($_REQUEST['post_id']);
        if ('premium' == $post_type)
            unset($tabs['library']);
            unset($tabs['type_url']);
    }
    return $tabs;
}
add_filter('media_upload_tabs', 'remove_media_library_tab');

Leave a Comment