Archives

Remove the Media Library Tab

I’ll leave the ‘why’ to you, but here’s the ‘how’

add_filter( 'media_upload_tabs', 'no_media_library_tab' );
function no_media_library_tab( $tabs ) {
    unset($tabs['library']);
    return $tabs;
}

Okay, one possible reason would be that you want to restrict users from accessing media that’s been attached to another post.

Remove Library Tab from Post-Side Media Pop-Up

I’m working on a plugin right now where I’m having to hide or limit a lot of features depending on the current user’s capabilities. Among those limitations is media uploading and editing access. I’m using this snippet to hide the Media Library tab from the Add an Image pop-up on the edit post page.

add_filter('media_upload_tabs','no_library_tab');
function no_library_tab($tabs) {
    if (!current_user_can('promote_users')) { 
        unset($tabs['library']);
    }
    return $tabs;
}