Skip Navigation

[Resolved] Image type post field. When I delete from post, it removes it from media library

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 replies, has 2 voices.

Last updated by Beda 6 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#465918
screenshot-delete-button.jpg
screenshot-image-field-type.jpg

I setup an image type field with multiple instances on a normal post. I edit that post, and add photos. When I come back to that post, if I click the "Delete (field name)" button it deletes the image file from the website completely.

I want to be able to just remove an image from a post. That way, it will still exist on the website and in the Media Library to be used somewhere else.

I notice when editing the post, if I just erase the text (the URL address of the image) in the field and update the post, that works, but it is not intuitive for my clients.

Thank you for your help.

#466161

I see the issue, and I must say I am rather Surprised, as usually, we do not delete Attachments - exactly because they could be used elsewhere!

Now, I see this happens only when the image is attached to ONE Post only, so at least it won't get removed from other posts.

Still, I am rather Surprised about this behaviour, as I share your opinion that it should not happen.

But I can not fix or change this right now. I have to report it to the Developers and ask for a change in the code.

For now, deleting the URL instead of the Repeating Field Instance is the only I can suggest.

#468739

In the upcoming release 2.3 this will be adjusted accordingly.

Until then the only way to avoid this is to not delete that image with the Button.

You might add a warning to your Users in the Fields' description.

#469064

Thank you very much!

#492969

This is just a notice that Types 2.3 is not yet released.
Right now 2.2.9 has been released.

As such this issue is still present.

#1072506

Next coming release, Types will not delete any attachments.

If you want to keep deleting the Attachments as the behavior is now, you would use this code in your functions.php:

add_filter( 'wpcf_delete_attachments', '__return_true' );

So, this will be fixed in the next release for you.

#1076116

This is now released…

The forum ‘Types Community Support’ is closed to new topics and replies.