Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

This topic contains 5 replies, has 0 voices.

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

Assisted by: Andreas W..

Author Posts
December 19, 2024 at 2:56 pm #16530677

ferdb

Background of the issue:
I am trying to edit pages in WordPress Administration, and when a language other than English is selected, all files in the Media Library show empty thumbnails. This issue prevents us from adding uploaded media while working on translated pages, except by adding them directly in the page source code. We use multi-domain to switch between languages. When English (default) is selected, an example thumbnail is loaded from hidden link. When French is selected, the same thumbnail is now loaded from this URL: hidden link. The same problem happens with the website itself. When switching to another language, all image URLs are suddenly rewritten, with the domain name injected in a similar fashion: hidden link. We have mitigated this problem using the Real-Time Find and Replace plugin, but this only works when viewing the pages. The plugin does not work when in Media Library.

Symptoms:
Media Library shows empty thumbnails when a language other than English is selected. Image URLs are rewritten with the domain name injected incorrectly, causing images not to load.

Questions:
Why are the media file URLs being rewritten incorrectly when switching languages?
How can I ensure that the Media Library displays thumbnails correctly for all languages?

December 21, 2024 at 6:12 pm #16536892

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

Hello,

This sounds as if the media can not be found as the second language uses a different domain. You would need to log into the second domain, like hidden link to be able to use its backend as expected.

WPML has an option to auto-login users in such cases at WPML > Languages > Site URL Format > Domains in different languages.

You are saying that you manually upload images in second languages.

Does this mean that you translate the content with the WordPress Editor?

Take note, that usually it is not necessary to upload images in second languages, unlesss you plan to use a different image in a second language.

WPML will always use the original image as reference for all languages.

You can sync the media library at WPML > Settings > Media Translation > Start, but take note, that if you already manually uploaded images in second languages, then this sync option might also create duplicates for those images in all languages.

This means, every upload is treated as original media, not matter in which language you upload the file.

The recommended workflow usually would be:

1) Upload the media on the original content only
2) Translate the content, while making sure that the media duplicate options inside the right sidebar of the WordPress Editor are enabled.
3) To replace images in second language with alternative versions, use WPML > Media Translation (Additional plugin).

Best regards
Andreas

December 24, 2024 at 9:26 am #16543125

ferdb

Hi Andreas, thank you for the extensive answers. In all fairness, this sounds very complicated. Our problem is actually quite simple:

- We want to upload the images once, while editing in ENGLISH language which is the default
- When we translate pages to other languages, we want the same images to be used

We haven't had a case yet when we need a different (translated) image. So we don't want to use any such features as media translations, duplication etc. etc.

The problem we face is two-fold:
1. We upload an image, while editing in ENGLISH. We create a page and add the uploaded image from media library. This is all, as simple as it is. When viewing the page, all looks good. For example, here's a URL of an uploaded logo file:
hidden link

Then we edit the French translation. When we view the translated page on .fr domain, the page is rendered correctly, BUT image URL is rewritten to
hidden link

Not only is the domain name changed from .com to .fr (which is correct), but domain name is injected AGAIN further in the path. End result is that the image is not rendered, because the URL is invalid.

2. Then, when we switch to French while in WP Admin, and open the media library, all media thumbnails are empty. Again, the same reason. URLs of thumbnails are rewritten, domain name is injected for some reason.

We patched the first problem by using Real-Time Find and Replace plugin. So at least our website renders correctly when foreign customers are visiting it. But this does not work when in WP Admin - thumbnails in the media library are still missing.

The answer we're looking for, is HOW to prevent this media URL rewrite from happening. We don't want and we don't need any media duplication. This will only create unnecessary work. We don't have varying images per domain. All we look for, is to see translated pages use the same original uploaded images.

Any ideas what to do, to achieve this? If modification of the WPML plugin code is required, we can handle that. Can you then point us to where does this URL rewrite / domain injection happen, so we can disable it? Thanks!

December 24, 2024 at 11:57 am #16543600

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

It seems there is a conflict between WPML and another plugin or the theme you are using.

Could you please create a staging site and try running the site with minimal setup to see if the issue persists?

1) Disable any additional plugins that are not related to WPML and our add-ons.

2) If the issue goes away, start by reactivating the plugins one at a time, or activate them in small groups. This way, check where the issue reoccurs to see the plugin that is causing the issue.

3) If this has not resolved the cause of the issue, please switch to a standard theme such as Twenty Twenty-One to see if the issue may be related to the theme.

Once we have identified the cause, we can then try replicating the issue and then escalate it internally. I will provide a test site with WPML in this case.

If you are unable to set up a staging site, or run those tests, please let me know and I will be happy to help you.

December 26, 2024 at 12:20 pm #16546847

ferdb

Hi, thanks for these suggestions, we'll try set up a staging site. Nevertheless, it doesn't seem that plugins are involved in all the problems. For as far as I understand, plugins aren't involved when logged in to WP Admin and browsing the media library. Yet it is there where we too see the URL rewrite with domain name injected in the thumnail URL, as described above. We'd appreciate any hints helping us understand which WPML code is responsible for this behaviour.

December 26, 2024 at 2:20 pm #16547053

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

Hello,

I can only provide more details about the issue if I get access to the site, create a local copy and run some tests.

I would like to request temporary access (wp-admin and FTP) to the site to investigate the issue further.

The required fields are below the comment section when you log in to leave the next reply. The information you provide is private, meaning only you and I can see and access it.

IMPORTANT
Please be sure to back up the site and database before granting us access.

If you can't see the "wp-admin / FTP" fields, your post and site login details will be set to "PUBLIC". DO NOT publish the data unless you see the required wp-admin / FTP fields.

I will need to install a plugin called "All In One WP Migration" here to create a copy of the site that I can use to investigate the issue further.

However, I would also be very grateful if you could provide a staging site or copy of the website from your server for this purpose. This staging site likely might need a similar domain per language setup and WPML will need to be registered on this new site.

The private reply form looks like this:
hidden link

The next time you reply, click on "I still need assistance".

Video:
hidden link

Please note that we are obliged to request this information individually on each ticket. We are not allowed to access any credentials that were not specifically submitted on this ticket in the private response form.

Best regards
Andreas

The topic ‘[Closed] Media library shows empty thumbnails when language other than English is selected’ is closed to new replies.