Title: Data loss with WPML
Last modified: August 11, 2026

---

# Data loss with WPML

 *  Resolved [Branimir Grbesic](https://wordpress.org/support/users/bgwebnorth/)
 * (@bgwebnorth)
 * [3 weeks, 3 days ago](https://wordpress.org/support/topic/data-loss-with-wpml/)
 * **Environment:** WordPress 7.0.3, WPML 4.9.6 + WPML Media Translation 3.1.2 (
   three active languages, media duplicated to translations), Enable Media Replace
   4.2.2
 * **Steps:**
    1. Upload an image. WPML creates three attachment posts, one per language, all 
       sharing one `_wp_attached_file` value and one physical file.
    2. Switch admin language to any one of them, open that sibling.
    3. Replace media → “Replace the file, use the new file name, and update all links”
       → upload a differently named file.
 * **Expected:** all siblings follow the replacement, or the old file is retained
   while other posts still reference it.
 * **Actual:** only the invoked sibling is repointed. The old full-size file is 
   deleted while two other attachment posts still reference it. Both remaining languages
   404 on full size.
 * **Cause:** `classes/Controller/ReplaceController.php:504` calls `@unlink($attached_file)`
   directly. This bypasses the `wp_delete_file` filter, which WPML uses in `WPML_Attachment_Action::
   delete_file_filter()` to block deletion of files still referenced by sibling 
   attachments. EMR’s own sub-size deletion in `classes/compat.php` does use `wp_delete_file_from_directory()`
   and is correctly blocked, which is why the thumbnails survive and the loss goes
   unnoticed.
 * **Impact:** irreversible loss of original media, silent because admin thumbnails
   continue to render.
 * Happy to provide additional information if needed.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Adrian](https://wordpress.org/support/users/adrianrus/)
 * (@adrianrus)
 * [3 weeks, 2 days ago](https://wordpress.org/support/topic/data-loss-with-wpml/#post-18991253)
 * Hi [@bgwebnorth](https://wordpress.org/support/users/bgwebnorth/) ,
 * Thank you for your message!
 * We’re checking this and will get back to you as soon as possible!
 * All the best,
 *  Plugin Support [Adrian](https://wordpress.org/support/users/adrianrus/)
 * (@adrianrus)
 * [3 weeks, 2 days ago](https://wordpress.org/support/topic/data-loss-with-wpml/#post-18991390)
 * Hi again, [@bgwebnorth](https://wordpress.org/support/users/bgwebnorth/) ,
 * Unfortunately, EMR doesn’t have support for WPML yet, so this is why it most 
   likely doesn’t work properly in your case.
 * Being a 100% free plugin, new features are coming on a best-effort basis, so 
   if you want, please feel free to leave a PR in our Github here: [https://github.com/short-pixel-optimizer/enable-media-replace](https://github.com/short-pixel-optimizer/enable-media-replace)
 * All the best,

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdata-loss-with-wpml%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/enable-media-replace/assets/icon-256x256.png?rev=1940728)
 * [Enable Media Replace](https://wordpress.org/plugins/enable-media-replace/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/enable-media-replace/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/enable-media-replace/)
 * [Active Topics](https://wordpress.org/support/plugin/enable-media-replace/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/enable-media-replace/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/enable-media-replace/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Adrian](https://wordpress.org/support/users/adrianrus/)
 * Last activity: [3 weeks, 2 days ago](https://wordpress.org/support/topic/data-loss-with-wpml/#post-18991390)
 * Status: resolved