How to prevent specific WordPress image (corresponding to ACF image field) from being deleted ?

Pending

Import WP Addon - Advanced Custom Fields Updated 2 weeks ago 4 Replies

Guillaume asked 3 weeks ago on June 17, 2026 at 7:19 am

Hi

I have an ACF image field (image_classe_energie) which is populated during import using an iwp function based on the value of another ACF field.

Basically the iwp function will check the value of another imported ACF text value and assign a WordPress image to the field based on that value (looks like if ($classe_energie == “A”) $image_classe_energie = “12102”;)

The problem is that if the record is deleted (ie the record no longer exists in the XML file) the image is deleted in WordPress. And i want to keep the “Remove related media” checkbox as other imported images are no longer needed …

Do you know how i can do that please ?

Regards
Guillaume

GH

Guillaume replied

3 weeks ago on June 17, 2026 at 7:56 am

Another question ...

If i store the URL of the image (and not the ID) and if i store that file on a remote server the importer will not be able to delete them. But is the importer will be able to delete other local files (i want that) please ?

Regards
Guillaume

GH

Guillaume replied

3 weeks ago on June 17, 2026 at 10:38 am

I made my way with a shortcode to display in frontend only (so i dont need another ACF field to store the image)

Regards
Guillaume

J

James replied Support Agent

2 weeks ago on June 22, 2026 at 7:59 am

Hi Guillaume,

Glad you managed to come up with your own solution, just to double check that you managed to resolve everything.

James

GH

Guillaume replied

2 weeks ago on June 22, 2026 at 8:21 am

Hi James,

Yes eveything is fine and the site is live.

You can close the ticket.

Thanks
Guillaume