Skip to main content
1 of 2

Disable media library tab for non admins in uploader screen

I am developing a plugin in which i am required to allow front end users to upload media, which i am able to do . but i dont want to let them sneak into media library which comes as tab with uploader screen

i tried somethin like :--

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

But seems this filter is depricated and no more works.. any other way out ? thank you.