Prevent users from deleting images
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 | 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 | Can I ask why? |
July 15, 2014 at 5:22 pm 23611 | |
Sekander Badsha | Hello Pjeaje, |
July 16, 2014 at 1:50 am 23629 | |
John | Thanks for your reply. I will have to remove the delete button then. |
July 20, 2014 at 2:35 am 23784 | |
John | Should anyone else wish to do this – I simply hid the delete button on the edit page with this:
(where page-id-[number] matches the page-id number of your edit form). It would not prevent someone determined to delete the images, but serves my purpose. |
November 15, 2014 at 12:00 am 30485 | |
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 | 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 🙂 |