Support

Account

Home Forums General Issues Can’t remove uploaded image from dokan produkt

Solved

Can’t remove uploaded image from dokan produkt

  • Hi, I use ACF custom field to add an image file upload field in dokan add/edit new product. Vendor can upload image but can’t remove it from product. When vendor remove image it look like image is gone but when you save product the image “jump” back.

    I want the image to be removed from product and deleted from media library, is that possible?

    Regards
    Daniel

  • ACf does not automatically delete images from the media library when they they are removed from images fields.

    I have no idea how you would do this with the plugin you are using.

    Just looking at ACF what you would do is create an acf/save_post action with a priority <10. In the action you use get_field() to get the current value of the field. The new value of the field will be in $_POST[‘acf’][$field_key]. The you would compare these 2 values. If the post ID for the old image is not present in new submission then you would use WP function to delete the attachment from media.

  • Hi John, thank you for your answer, i am not a pro, but can I create that function with ACF plugin or do I need to code it with code snippets?

  • You would have to code it yourself and add it to functions.php or some other way.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.