I need the ability to allow users to insert media (images) into a page / post, but not allow them to upload the files.

The only capability I can see is 'upload_files', which allows a user to upload / insert files.

Is there a way to prevent upload of files but still show the media manager (via the 'Insert Media' button on the Edit screen) allowing users to insert the images?

My thought of how to approach this would be via jQuery - run a script when the capability is something like 'my_insert_media', which would hide the 'Upload' tab of the media uploader. Of course this could be worked around by disabling Javascript in the browser, but that's not a major concern for this project.

Any other suggestions, or holes in this approach?

Thanks, Dan

1 Answer 1


You can try with this:

function remove_media_tabs($strings) {

  return $strings;

This will remove 'Upload file' and 'Insert from URL' links when you open insert media screen, so user will be able only to select images or whatever that is already in media library.

For more things you can do with unset, check in: wp-includes/media.php file.

  • Your code remove the tabs from the HTML but doesn't remove the capability of the user to upload files what can be still done.
    – cybmeta
    Commented Apr 28, 2014 at 18:37
  • Cybnet please could you give more info here - not sure what you mean - my question was about removing the visual capability, rather than the underlying security, as this is a known organisation who can manage it by a business process.
    – Dan Smart
    Commented Apr 29, 2014 at 15:23
  • @cybnet that is correct, but it may do the trick, depending on what are you working on.
    – Bobz
    Commented Apr 30, 2014 at 17:59
  • @DanSmart what you can do eg, trough inspector set div 'uploader-window' to visible (display: block; opacity: 1) and you can upload files. You can 'hack' a way to upload files, and this is not exact answer to your question but it might be useful if you don't need high security. Also check for hook 'plupload_default_settings' in wp-includes/media.php Maybe you can set 'max_file_size' = 0 for user role xyz. Or add custom capability, and then use that as referance to disable upload.
    – Bobz
    Commented Apr 30, 2014 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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