Home›Support›English Support›[Resolved] Issue: Media file URLs still pointing to old subdomain after domain change
[Resolved] Issue: Media file URLs still pointing to old subdomain after domain change
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues with media file URLs not updating after changing the domain for the Spanish version of their website. Despite updating WPML language domain settings and clearing caches, media files still reference the old subdomain. The client wants a single, shared media library across all languages. Solution: We recommend checking if the issue with media URLs still persists as sometimes changes might take effect after a delay. If the problem continues, ensure that the WPML Media Translation module is properly configured to use a single media library across all languages. You can do this by navigating to WPML → Media Translation and ensuring that the option to duplicate media files for translated content is unchecked. Additionally, use a plugin like Better Search Replace to search for old domain references in your database and replace them with the new domain. If you're still facing issues or if this solution does not apply to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, please open a new support ticket at WPML support forum for further assistance.
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.
Background of the issue:
I am trying to resolve an issue with media file URLs after changing the domain for the Spanish version of my website. Originally, the Spanish content was served from a subdomain: es.relatedpresence.com. Now, I’ve switched to a dedicated domain: presenciarelacionada.com. In WPML → Languages, I have updated the domain for the Spanish language, and the language switcher and all regular pages reflect the correct domain. However, media files still reference the old subdomain. I have tried updating WPML language domain settings, clearing all site caches, using the 'Start' button under WPML → Media Translation, and running Better Search Replace across all relevant database tables. I want to use a single, shared media library across all languages. Link to a page where the issue can be seen: hidden link
Symptoms:
Media files uploaded under the Spanish language still reference the old subdomain in their URLs, even after updating domain settings and clearing caches. Newly uploaded images also point to the old domain.
Questions:
Where is WPML storing the outdated es.relatedpresence.com domain references for media items?
How can I safely resync media URLs to reflect the current domain configuration?
How can I ensure that new uploads under the Spanish language respect the updated presenciarelacionada.com domain?
Dear Andrey,
Thank you for your reply.
I clicked the apply button at Translate Link Target.
After it finished the process, I emptied the cache in file manager.
Unfortunately still have the same problem.
And I see the es.relatedpresence.com folder in the fresh cache - instead of presenciarelacionada.com folder.
And also strange, that the menu in the English and Hungarian Home page doesn't show the Spanish flag, although the page translated and ready. Other pages shows the flag properly.
Yes, I put the code 1
do_action( 'wpml_switch_language', $language ); in the class-wpml-media-image-translate.php
After I used the 2nd method again by Translate Link Target process.
I emptied all the caches and I opened the website in incognito window.
Unfortunately there is no change.
If that can be helpful, I can give you an admin entrance for the website.
Were the images originally uploaded through the es.relatedpresence.com domain, or were they initially uploaded from the English version of the site?
To clarify (if I correctly understood), if you upload a new image while using the Spanish version, does it still display the old domain in the URL?
I need to request temporary access (wp-admin and FTP) to your site—preferably to a test site where the problem has been replicated if possible—in order to be of better help. When you log in to leave your next reply, you will find the needed fields below the comment area. The information you will enter is private, meaning only you and I can see and access it.
In the meantime, could you please clarify how the images are being set on the page (for example)? Upon a quick inspection, I noticed that the image URLs appear to be correct in the Media Library. This information will help me better understand where the issue might be. It feels like the image URLs are hardcoded.
We have not hardcoded image URLs across the site — all images were added via the standard Divi Builder interface using image modules or background settings.
However, on the Spanish homepage (/inicio), I did experiment briefly with manually inserting the image URL from the English version in an attempt to solve the broken image issue — but this did not resolve the problem, so I can revert it if you wish. I have not applied this method on any other page.
Interestingly, on mobile, the hero image on the Inicio page does appear correctly, while it does not show up on desktop — which makes me wonder if there’s some caching or layout discrepancy happening as well.
In addition, I’m now seeing a few more unexpected issues on the Spanish homepage:
The content showing appears to be the English version.
The menu item says “Home” instead of “Inicio”.
There is a number “3” displayed next to the menu item, only in the Spanish menu.
Caches have been cleared, but these issues persist.
Let me know if you need further details or screenshots — and thank you again for your continued support.
We have not hardcoded image URLs across the site — all images were added via the standard Divi Builder interface using image modules or background settings.
Could you please share a screenshot to illustrate this? Or were you able to fix the issue already? I’m asking because I now see that the images are appearing correctly on the site.
The content showing appears to be the English version.
The menu item says “Home” instead of “Inicio”.
There is a number “3” displayed next to the menu item, only in the Spanish menu.
The reason the menu says “Home” is likely because the Spanish homepage still has the title “Home” instead of “Inicio.” To correct this:
1. Open the original (English) homepage.
2. Make a small change (e.g., change “Home” to “Home.”), save the page, then revert the change and save again.
3. Open the WPML translation editor and update the Spanish translation by changing the title to “Inicio” and completing the translation.
Your suggestions helped a lot:
I retranslated the homepage
Cleared all caches
And now everything seems to display correctly — including all images across pages and languages.
Also, the es.relatedpresence.com references have disappeared from the cache folders and media URLs, which is great.
There is only one issue remaining:
The Spanish version of the site logo (SVG) does not display correctly.
I tried to assign the translated logo using Media Translation, but:
It shows a broken image icon in the interface
And it loads the English logo instead on the frontend
Interestingly, the Hungarian version of the logo works fine.
This issue affects only the Spanish SVG.
I’ve attached a screenshot below that shows what happens on the Media Translation screen.
📎 See attachment: logo missing.jpg
The logo's permalink: hidden link
File URL: hidden link
Could you please advise how to fix this or suggest a better way to assign the SVG logo for each language?
Thanks again for your help and time — I really appreciate your detailed responses!
Warm regards,
Edina Góra
New threads created by Andrey and linked to this one are listed below: