Allow WordPress User Roles To See Specific Media Files

We had an interesting question from a PublishPress user. They wanted to create a WordPress user role where all users in this role could only see specific media files. They did not want the users in this role to be able to see other media files.

This request is possible thanks to the PublishPress Permissions plugin. With the Permissions plugin, it's possible to limit a user role to seeing only specific media files. In this guide, I'll show you how to control access to single or multiple files in the WordPress Media Library.

Before you start this guide, follow these two steps first:

  • Make sure you have the PublishPress Permissions plugin installed.
  • Go to Permissions > Settings > Core.
  • Enable the “Media” checkbox.
PublishPress Permissions settings

Option #1. Individual Media Files

In this first example, we're going to control access to a single image.

  • In this screenshot below, I have five images in my Media Library. I want to hide only the image of the bird.
Controlling access to WordPress Media files
  • Click on the image in the Media Library.
  • Click “Edit more details” as in the screenshot below:
Editing access to WordPress Media files
  • Scroll down to the “Permissions: Read this media” area.
  • Choose “Blocked” for the role that should not see this image. In this example, I'm blocking access for the “Customer” role.
Blocking access to WordPress Media files
  • Scroll down to the “Permissions: Edit this media” area.
  • Choose “Blocked” for the role that should not see this image. Again, I'm blocking access for the “Customer” role.
Blocking edit access to a WordPress Media file
  • When the user in the “Customer” role logs in now, they will see something like the image below. They will not see nor be able to edit the image at all.
Restricted access to WordPress Media images

Option #2. Multiple Media Files

To control access to multiple media files, you don't have to limit control to each file individually. In this example, I want to limit my “Customer” user role to only see two images on my website

  • Go to Permissions > Groups > [your role name].
  • Post Type: Media.
  • Operation: Read.
  • Adjustment: Limit to.
  • Select Media: Choose the files.
  • Click “Add Selected” to complete the process.
Controlling access to multiple WordPress Media files
  • The next step is to repeat this process for the editing permissions of the “Customer” user role.
  • Post Type: Media.
  • Operation: Edit.
  • Adjustment: Limit to.
  • Select Media: Choose the files.
  • Click “Add Selected” to complete the process.
Controlling access for editing multiple WordPress Media files
  • When the user now logs in, they will only see the two images, as in this screenshot.
Restricted access to WordPress Media files

Using a Teaser for Media Files

PublishPress Permissions Pro allows you to choose messages to display for people who try to access your media files, but don't have access. Click here for an introduction to Teasers.


Summary of Media Access with PublishPress Permissions

To wrap things up, PublishPress Permissions is a great plugin to limit user roles to see only specific media files.

There are many available variations of this process. For example, you can create a user role that can only access the Media Manger. Or you can control who can delete media files. You can also stop users from seeing media files from other users.

PublishPress Permissions can do all of these tasks and more. Let me know in the comments if you have any questions.

One Comment

  1. Thank you for writing this awesome little tutorial and giving references to other media control options such as who can delete media files.

Leave a Reply

Your email address will not be published. Required fields are marked *