How to remove the Media Library tab in the WordPress media uploader

October 8, 2010 12:09 PM by Ann

By default, WordPress allows a user with the “upload_files” capability to view all items in the media library. Here’s how to remove the Media Library tab in the WordPress media uploader completely (e.g. for contributors without the “edit_others_posts” capability).

Copy and paste the following code into a plugin or the theme functions.php file:


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