Stop WordPress Users Seeing Media Files From Other Users
In another tutorial here at PublishPress, we showed how to hide other users' posts in the WordPress admin area. This means that users will only see their own posts when they log in to WordPress.
One PublishPress member asked us if it was possible to do the same thing for the Media Library.
Yes, it is possible to set up WordPress so that users only have access to files that they uploaded. You can do this with the PublishPress Permissions Pro plugin.
Let me show how you can configure this to work on your site.
- Install the PublishPress Permissions Pro plugin.
- Go to Permissions > Settings.
- Click the “Editing” tab:
Scroll down to the “Media Library” area. Here you're going to see 5 options you can use to control access to files inside the Media Library:
- List other users' uploads if attached to a readable post: If this boxed is checked, users can view other people's media files if they are attached a post they can read.
- List other users' uploads if attached to an editable post: If this boxed is checked, users can view other people's media files if they are attached a post they can edit.
- Edit other user' uploads if attached to an editable post: If this boxed is checked, users can edit other people's media files if they are attached a post they can edit.
- Other users' unattached uploads listed by default: If this boxed is checked, users can view other people's media files
- Users can always edit their own attachments: If this boxed is checked, users can always edit attachments they have uploaded, even if they are later attached to a post which the user cannot edit.
These 5 options can be used in a variety of ways, but the fourth option is key. If you uncheck this box, you will automatically hide other people's files for most users:
Testing the media restrictions
I unchecked the “Other users' unattached uploads listed by default” box.
Now let's see the impact of that change.
I browsed to the Media Library as an Administrator. This image shows what I saw:
I logged out and logged in again as an Author user. This image below shows what I saw now. All the files uploaded by other users are hidden to me.
As you can see with the 5 options above, there are potential complexities with editing media files. For example, you can deny a user access to a file that someone else has uploaded. But what happens if you also give that user the ability to edit a post where that image is used? Those 5 options we saw earlier give you ways to deal with those scenarios.
For more on Media Library permissions in WordPress, check out these guides:
Get the PublishPress plugins
The Pro versions of PublishPress plugins are packed with extra features to help you manage your content. Get a PublishPress membership today for full access: