Home Forums Plugin Support WP User Frontend Pro Prevent users from deleting images

This topic is: resolved

This topic contains 7 replies, has 4 voices, and was last updated by  Sekander Badsha 4 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23390

    John
    Member
    Post count: 63

    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?

    #23431

    Sekander Badsha
    Member
    Post count: 2067

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

    #23549

    pjeaje
    Member
    Post count: 12

    Can I ask why?

    #23611

    Sekander Badsha
    Member
    Post count: 2067

    Hello Pjeaje,
    Whom are you asking to ?

    #23629

    John
    Member
    Post count: 63

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

    #23784

    John
    Member
    Post count: 63

    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.

    #30485

    epictum
    Participant
    Post count: 23

    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?

    #30967

    Sekander Badsha
    Member
    Post count: 2067

    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 8 posts - 1 through 8 (of 8 total)

The topic ‘Prevent users from deleting images’ is closed to new replies.