Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is adding a third language to a website with 1.5 million images and faces issues with media translation. The media library appears empty for the new language, and duplicating all images would be inefficient. The client inquired about using the 'Translatable – use translation if available or fallback to default language' setting for the 'attachment' post type to address this.

Solution:
We explained that the 'Fallback' setting for media will not work as expected. Media must exist in the media library for all active languages to display correctly across the site. To synchronize media across languages without manual duplication, follow these steps:
1. Navigate to WPML > Settings > Media Translation.
2. Disable the option to automatically detect media for translation.
3. Access the manual setup from the dropdown.
4. Check all boxes for existing and new content.
5. Click "Start the process" to create necessary entries in the database.
This process will take time based on the number of images but will ensure that media is available in all languages without filling up the database unnecessarily.

For more details on setting up media translation, visit WPML Media Translation documentation.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. Also, check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. For further assistance, please visit our support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 24 replies, has 0 voices.

Last updated by Andreas W. 5 months, 3 weeks ago.

Assisted by: Andreas W..

Author Posts
November 11, 2025 at 3:34 pm #17567457

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

On the test site, the media is already synced when being uploaded to the media library in the site's default language.

I am sorry, but I am not escalating this, as I am 100% sure that this behavior is expected and there is sadly no workaround that I could offer.

If you do not agree with my decision, please open a new support ticket and consult a different supporter.

November 11, 2025 at 3:51 pm #17567615

thomasA-35

"On the test site, the media is already synced when being uploaded to the media library in the site's default language."
-> Only because you disabled the "Automatically detect best options for translating image texts" just now. With this option (that is even recommended in a banner now that is disabled!) the media is NOT synced between languages when uploaded to the media library.

It would be much easier if you could just assign a different supporter to this ticket where they already have all the context. But if creating a new support ticket is the only way for me to receive support, I will do that.

November 11, 2025 at 4:11 pm #17567705

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

This is correct in this case, as while the option "Automatically detect best options for translating image texts (alt, caption, title)" is enabled, the media will only be synced once you translate a post that contains a featured image.

This does not change the fact that the media will only show in a second language if it exists in the media library in the current active language, and this can only be achieved by syncing the media.

Syncing the media in this case means that WPML created database entries that allow displaying the media in each language inside the media library.

This said, if the media exists in all languages in the media library, it is synced.

The "Fallback" feature does not influence that. Otherwise, the media would show up on translations if a media entry does not exist inside the media library in the currently active language.

November 11, 2025 at 5:06 pm #17567910

thomasA-35

I am just quickly reopening this ticket to add the reply I got when creating a new support ticket, in case someone has a similar problem.

This time, I was redirected to WPML's AI assistant (I probably landed on some blacklist 😄). The answer was completely different from what Andreas told me. Of course an AI bot cannot be completely trusted, but I assume it has good training on internal documentation and code. So here is the answer:

---
Hi there! I understand you're working with a very large website, managing approximately 1.5 million images with your theme, and aiming for optimal performance by minimizing media duplication. That's a significant setup, and it's great you're thinking proactively about database efficiency.

You've accurately identified that the "Automatically detect best options for translating image texts" setting, while generally recommended for streamlining media translation, can lead to images not appearing in your media library on secondary languages. This often happens because this setting intelligently creates translations of media metadata only when necessary (e.g., when an image is associated with a translated post via the Advanced Translation Editor), rather than duplicating the attachment post itself for every image across all languages.
Your observation that setting the "Attachment" post type to "Use translation if available or fallback to default language" resolves the issue of missing images in secondary language media libraries is correct. This setting is indeed a valid and often optimal approach for sites like yours, where the majority of images don't require distinct translated texts and the primary goal is to ensure their visibility and usability across all languages without unnecessary database duplication.

Let's address your questions about why this option might be behind a lock or not listed as the default recommended option:

"Not Recommended" Context: The WPML documentation generally advises against turning off the "Automatically detect best options for translating image texts" setting and managing all media translation settings manually. This recommendation is primarily to prevent common pitfalls like unnecessary duplication of media texts (alt text, captions, titles) or missing translations if not configured meticulously. However, selecting "Use translation if available or fallback to default language" for the Attachment post type itself is a different, more general post type translation setting. It doesn't mean you're manually configuring every aspect of media text translation, but rather defining the fallback behavior for the attachment post in your media library.

The "Lock": The lock icon indicates that this is an advanced setting that requires a clear understanding of its implications. For many users, the automatic detection is sufficient. But for your specific use case, with 1.5 million images and a strong focus on performance and controlled duplication, this advanced setting is precisely what you need.

There is no technical or functional reason not to use "Use translation if available or fallback to default language" for attachments in your scenario. In fact, it's an excellent solution to achieve your goals of performance and media accessibility. It ensures that if an attachment post doesn't have a specific translation, the default language version will be displayed and selectable, which is exactly what you're looking for.

Here’s how you can set this up for your attachments:
Navigate to WPML → Settings in your WordPress admin dashboard.
Scroll down to the Post Types Translation section.
Locate the Attachments (attachment) post type.
Select the option "Use translation if available or fallback to default language".
Click the Save button at the bottom of the page.

After applying this setting, please verify that your media library in secondary languages now displays the expected images, allowing you to manually create or update pages effectively. This approach aligns perfectly with your site's needs for efficient media handling.

November 11, 2025 at 5:10 pm #17567913

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Human support feedback:

There is a technical or functional reason not to use "Use translation if available or fallback to default language" for attachments, and this is a known limitation in WPML.

How to test that "fallback" has no influence on attachments:

1) Create a post and upload a featured image
2) Translate the post
3) Go to the Media Library and switch to the second language in the admin bar
4) Remove the entry for the media file in the second language
5) Enable "Fallback" for media attachments in WPML's post types translation setting
6) Visit the translated post

Expected:
No media will show up on the translation, as the media is no longer synced inside the media library. The fallback setting has no effect.

This is why WPML's configuration file locks the setting for media attachments by default to "Translatable - only display translated items". Such default configs should not be altered if they are locked by default.

November 11, 2025 at 5:28 pm #17567922

thomasA-35

Thank you for continuing to look into this issue Andreas.

I am not sure why you choose this use case as an example for "Fallback" having no effect. What you describe is completely logical and has nothing to do with the "Fallback" setting.
If I translate a post via the WPML translation editor and WPML creates a duplicate for the featured image, the ID of this duplicate is then set as featured image for the translated post. When I manually delete this duplicate in the media library, the ID saved on the translated post points into the void and the featured image is missing of course.

If however I manually create a post in the secondary language using the Gutenberg editor, the "Fallback" setting clearly has an effect:
- Without "Fallback", the media library is empty
- With "Fallback", all images are available and I can use them in my post. Wen saving the post, no duplicates are created in the background, just as it should be.

November 11, 2025 at 5:41 pm #17567956

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I understand, this seems unexpected and looks like a bug in this case.

If the media is not synced, it should not show up inside the media library when editing a post in a second language, but the images that you see there are actually the original images, as fallback is enabled. Note that this is only the case when using Gutenberg, not when using the Classic Editor.

What you’re seeing is a matter of how WPML handles media attachments in the database, combined with how Gutenberg displays them when the “fallback” option is enabled.

In Gutenberg, you may see original images appear because the editor is pulling them directly, but that’s not true synchronization — it’s just how Gutenberg handles the fallback reference.

The difference in images appearing in Gutenberg but not in the Classic Editor comes from how each editor queries the media library.

As the fallback setting has no effect on Media (attachment), I can only recommend leaving it on its default setting, and this way you avoid this issue inside the media library when adding media to a translated post.

If you insist, I can escalate this bug further, but as this is a minor issue due to a provoked misconfiguration, it is likely that our devs will not solve this issue quickly, or a fix might even be rejected.

Also, if you use the WPML Translation Editor as a translation method, it is not advisable to edit translations directly inside the WordPress Editor as such edits will be overwritten once you translate the post or page again with the WPML Translation Editor.

The recommended workaround would be:
Do not use the "fallback" setting for media attachments.

November 11, 2025 at 6:12 pm #17568052

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

The Gutenberg bug, which occurs when adding media to translated posts while having media attachments set to "fallback" has been escalated for internal review.

Once I have more feedback on this matter, I will keep you updated on this ticket.

November 12, 2025 at 9:28 am #17569474

thomasA-35

Thank you Andreas. We disagree here on what is a bug and what is the expected behavior, but I am interested what 2nd tier has to say about this.

I also created another ticket as you suggested and just got confirmation from another supporter that using the "Fallback" option should work just fine for attachments, if the title/alt text does not need to be translated. So in case someone else has this issue, I would also recommend reading this thread:
https://wpml.org/forums/topic/media-translation-auto-setting-leads-to-missing-images-in-media-library/

November 12, 2025 at 2:38 pm #17571395

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

In fact, there are changes in the latest version of WPML. In the past, the media was always synced on upload. In the new version, media is no longer synced on upload; it is only synced once you translate content that contains the media.

Regarding fallback for media:

I have been working since 2018 on WPML Support, and it was never possible to display media on the fallback on the frontend of the website. The second-tier support confirmed this today, too.

The media needs to be synced in the media library to be able to be displayed on the frontend, and the fallback option has no influence on that.

I provided a sandbox that confirms this behavior.

This is why the translation preference for media is by default locked inside WPML's wpml-config.xml file and should not be set to "fallback" as it can cause unexpected behavior.