WordPress Users Can’t Edit the Details for Media Files
A PublishPress user wrote to us with question:
I have just installed your PublishPress Capabilities plugin, which is working almost perfectly. The problem that I'm having is that my user can upload images but can not edit the Alternative Text, Title, Description and Caption of the image, which I need the user to be able to do. How can I fix this problem?
This is not the first time we have had this question, so I'll explain the problem and solution.
The problem with editing media files
This situation often arises when you do these two things for a user role:
- Remove access to Posts and Pages.
- Give access to another plugin.
This image below is taken from the main PublishPress Capabilities screen. I have removed access to both Posts and Pages, but given this user access to WooCommerce Products, Orders and Coupons.
In this situation, this user will not be able to edit any of these fields for a media file:
- Alternative Text
Why does this problem happen?
Normally, to edit the details for this media files, you need the edit_posts permission.
Even if you do have the edit_posts permission, you will only be able edit files that you have uploaded. You will also need the edit_others_posts permission to change the details for other users' files.
Those two permissions are shown in this next image:
Note: if you want to control who can upload media, use the upload_files permission.
The solution to editing media files
In most situations, you solution is not give the edit_posts permission. This is because you have already decided that users should not be editing posts.
Here is a better solution:
- Go “Capabilities” in your WordPress admin menu.
- Choose the user role you want to change in the “Select Role to View / Edit” box.
- Check the “Media” box under “Type-Specific Capabilities“.
- Click “Update”.
- Now you can see three new boxes in the “Media” row. You can use these boxes to allow your user to edit, create or edit others media files.
You can also extend this feature to control who can delete media files.
- Install the PublishPress Permissions plugin.
- Go to “Permissions” then “Settings”.
- Click the “Core” tab.
- Check the ” Enforce distinct edit, delete capability requirements for Media” box.
- Go back to the “Capabilities” screen and you can now control who edits, creates and deletes media files: