Prevent users from deleting images

This topic contains 7 reply and 4 voices, and was last updated by Sekander Badsha 10 years ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
July 12, 2014 at 6:16 pm 23390
Sekander Badsha Short of disallowing editing of posts or removing the Image Delete button from the Edit Form, is there any other way to prevent users from deleting images from the media library? In other words, is it possible to allow users to delete images from their posts without the images being deleted from the Media Library?
July 13, 2014 at 12:19 pm 23431
Sekander Badsha Sekander Badsha

WordPress doesn’t refine user access that much. And the feature you’re asking is currently quite impossible.

July 14, 2014 at 10:03 pm 23549
pjeaje pjeaje

Can I ask why?

July 15, 2014 at 5:22 pm 23611
Sekander Badsha Sekander Badsha

Hello Pjeaje,
Whom are you asking to ?

July 16, 2014 at 1:50 am 23629
John John

Thanks for your reply. I will have to remove the delete button then.

July 20, 2014 at 2:35 am 23784
John John

Should anyone else wish to do this – I simply hid the delete button on the edit page with this:

/* hide Delete button on Edit Form */
.page-id-275 .attachment-delete {
   display: none !important;
}

(where page-id-[number] matches the page-id number of your edit form).
The same technique could of course be used for the submission page.

It would not prevent someone determined to delete the images, but serves my purpose.

November 15, 2014 at 12:00 am 30485
epictum epictum

Hey there – I’d like to revisit this topic by asking this question… would it be possible to “Remove” the featured image instead of deleting it entirely like you’re able to do in the WP Dashboard with Set/Remove?

November 22, 2014 at 6:34 pm 30967
Sekander Badsha Sekander Badsha

Hello Epictum,

The image location is saved inside post meta. So when ever an user deletes it the post meta gets updated and the image is deleted. So we do not have any feature to keep that image intact.

But I will ask the developer team to get an alternative way to keep the image safe even after deletion.

Thank you 🙂

Viewing 7 Posts - 1 through 7 (of 7 total)