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

Pending

Import WP Addon - Advanced Custom Fields Updated 7 hours ago 2 Replies

Guillaume asked 10 hours 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

10 hours 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

7 hours 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