How to Allow WordPress Users to Delete Images and Files

How to Allow WordPress Users to Delete Images and Files

By default, WordPress is very, very careful about who can delete files in your site’s Media Library.

Only users in the “Administrator” role are able to delete images and files in your Media Library. Anyone who is in the Subscriber, Contributor, Author and Editor roles is not allowed to delete images.

However, on some sites you may want to allow other users to clean your Media Library. Perhaps you have private files, or just have a cluttered Media Library with too many files.

The solution to deleting files is to install the PublishPress Capabilities plugin.


Once both those plugins are installed, go to “Capabilties” in your WordPress admin area.

In the right sidebar, check the “Media” box under “Force Type-Specific Capabilities”. This will allow you control the permissions for the Media Library,

Unique Post Type Capabilities

In the top-left corner of the screen, load the user role that you want to customize permissions for. In this image below, I’ve chosen the “Editor” role (click here to read about Editors capabilities).

Choose Editor role

In the center of the screen, you can now set your permissions. If you want to allow people in this role to delete anything in your Media Library, go to the “Deletion” tab and check all the boxes in the “Media” row.

Delete Media capabilities

Click “Save Changes” at the bottom of the screen.

It’s as simple as that. Now whenever a user in the “Editor” role goes to the Media Library, they’ll see a “Delete permanently” option for any file they see:

to delete WordPress images and files permanently

To make this work, check out the the PublishPress Capabilities plugin. At that site, you’ll find more on this topic, including this post: “Which WordPress Users Can Delete Files From the Media Library?

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

    View all posts
0 0 votes
Article Rating
Subscribe
Notify of
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
HM
HM
5 years ago

Steve, I am not sure about some of the information in this article. I am a WordPress admin and I recently added a new user with Editor role to add a few new pages. When I requested her to clean up the large number of images she added (most of which were not being used), she accidentally deleted most of the images from the Media Library. Suffice it to say, it took us some time and effort to get back to status quo. We don’t have any user plugins installed so we are using default WordPress functionality and it allowed this editor to delete the entire Media library!

JB
JB
3 years ago

Any option to do this without a plugin?
Like other capabilities set in defining a role.
‘delete_posts’ => true,

3
0
Would love your thoughts, please comment.x
()
x