WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a clients site, one of the features they want is for his Editors or Authors to only be able to select existing images to insert into Posts from the Media Library.

So looking at the media manager/upload screen below, is it possible to make the Upload Files tab to only be visible to Admin Users and also to make the Media Library shown by Default when this Dialog is shown?

enter image description here

share|improve this question
You may want to check out the Adminimize plugin, there are a variety of different options that may fit your needs. – Charles Jul 13 '13 at 14:55
This plugin does just hide it with CSS. When I open up the developers tools or FireBug (or whatever browser you use), you can simply remove display: none; and can access everything. – kaiser May 18 '14 at 15:11

Method 1:

Remove the upload_files capability from the respective roles.

e.g. removing it from author:

$role = get_role( 'author' );
$role->remove_cap( 'upload_files' );

This is saved to the database so it should only happen once, not on every page load. Removing it from the editor role should be the same albeit with the obvious modification. Removing the capability will have the desired effect, but it may have additional effects you may not find so desirable, the only way to be sure is to test

Method 2

Consider this code, which will make the upload error out if the user does not have admin privileges.

 * Plugin Name: Admin Only Uploads
 * Description: Prevents Uploads from non-Admins
 * Author: TJNowell
 * Author URI: http://tomjn.com
 * Version: 1.0

function tomjn_only_upload_for_admin( $file ) {
    if ( ! current_user_can( 'manage_options' ) ) {
        $file['error'] = 'You can\'t upload images without admin privileges!';
    return $file;
add_filter( 'wp_handle_upload_prefilter', 'tomjn_only_upload_for_admin' );

You can make use of this filter to be more specific than upload_file, e.g. preventing the upload of images, and only images, but allowing audio, etc

share|improve this answer
Doesn't this remove the entire media library? – onetrickpony Jul 6 '13 at 18:30
Hence method #2 – Tom J Nowell Jul 6 '13 at 20:03
Method #2 works like a charm! My setup: some images are uploaded by the admin, while other users can only view the admin's images and cannot upload their own. Cheers! – liviucmg Jan 17 '15 at 19:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.