Skip Navigation

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

Problem:
After updating WPML, the language settings for the websites soranora.com and soranora.lt got mixed up, causing soranora.com to display in Lithuanian and soranora.lt in English.
Solution:
We discovered that the issue stems from the

\Hostinger_Temporary_Domain_Handler::replace_in_array_recursive

method in the

wp-content/mu-plugins/hostinger-preview-domain.php

file. This method is triggered by

Hostinger_Temporary_Domain_Handler::replace_host_in_option

, which recursively replaces options and updates the current domain to the one set as siteurl.

If this solution does not resolve your issue, or if it seems outdated or irrelevant 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 problems persist, please open a new support ticket.

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.

Tagged: 

This topic contains 0 replies, has 1 voice.

Last updated by audriusL 2 weeks, 3 days ago.

Assisted by: Osama Mersal.

Author Posts
April 7, 2025 at 7:16 am #16902479

audriusL

Background of the issue:
I was trying to maintain the correct language settings for my websites: soranora.com should be in English, and soranora.lt should be in Lithuanian. After updating WPML, the languages got mixed up. The issue can be seen at hidden link.

Symptoms:
After the WPML update, soranora.com started showing Lithuanian language, and soranora.lt started showing English language. soranora.lv and soranora.ee have the correct languages.

Questions:
Why did the languages switch after the WPML update?
How can I restore the correct language settings for soranora.com and soranora.lt?

April 7, 2025 at 7:37 am #16902586

audriusL

In settings domain for Lithuanian language became incorrect. After changing it back to normal soranora.lt, problem remains for home page.

If product page or archive is entered from there, then language is correct - Lithuanian. But home page is a problem.

April 8, 2025 at 6:10 am #16906828

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. Before passing this thread to my colleague, I would like to share some suggestions and possible solutions for the issues you mentioned.

Does it happen after upgrading from the PML 4.6.15 version to the WPML 4.7.3 version? Have you made any changes to the site after upgrading to the latest versions? Please confirm.

Also, please share the WordPress debug.log (not WPML debug information) with us so we can collect more details on this. Refer to the following pages for instructions

https://wpml.org/documentation/support/debugging-wpml/

https://wordpress.org/documentation/article/debugging-in-wordpress/

To enable the WordPress Debug log, open your wp-config.php file of site root and look for define('WP_DEBUG', false);. Change it to:

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
 
// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );
 
// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

In this case, the errors will be saved to a debug.log log file inside the */wp-content/* directory. Please follow the steps to reproduce the bug and check if you are getting any errors or warnings related to WPML in the log file.

If you can paste your debug.log to http://pastebin.com/index.php and provide me with that link, it would be great! (This is the cleanest way because sometimes the logs are long and create a complete mess of discussion).

--
Thanks!

Bigul

April 8, 2025 at 4:46 pm #16910442

audriusL

debug.log has no errors.

Upgrade was done from 4.7.2 to 4.7.3 security fix. After it, last language in "domain per language setting" gets default domain name. Domain was replaced back to normal, site started to work again, but next day, last domain in a list was set to default domain again.

Now I have added one more language and domain to the list, to check if problem will remain and does the new domain at the end of the list will be set to default domain again.

April 9, 2025 at 12:19 pm #16913320

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I'm Osama from WPML forums support. I'll be glad to help you today.

Please let me know if the issue persists after adding the new domain.

If yes, please check if the issue persists in a minimal environment by following these steps.

1- Deactivate all the plugins except WPML CMS.
2- Switch to a WordPress default theme like Twenty Twenty-one.
3- Keep an eye on the language settings.

If the issue is gone, activate them one by one to see which one is causing an interaction issue.

❌ Please back up your database before the above test ❌

Best regards,
Osama

April 9, 2025 at 2:00 pm #16914237

audriusL

Issue persists.

I can not disable plugins and change theme. It's a production site.

When another plugin generates product catalog list, for Lithuanian language it makes .com urls instead of .lt. It looks like wrong domain comes from WPML API.

It's also unclear when domain for Lithuanian language is reset to the default one.

April 9, 2025 at 2:46 pm #16914518

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Do you have a staging site where we can test the minimal environment?

If not, please let me know, and I'll create one on our test server so you can migrate your site there.

Best regards,
Osama

April 9, 2025 at 5:39 pm #16915281

audriusL

No, I don't have any at the moment. But I have feeded an older plugin version and the new one for the AI, to analyse the differences and find possible problems. This is what I got.

Analysis of WPML Domain Per Language Issue

Based on my analysis of the WPML plugin code, I've identified a potential issue that could cause the "A different domain per language" setting to malfunction, resulting in language domains being reset to the default domain.

The Problem
The issue appears to be related to how the domain settings are handled in the URL conversion process. When a language domain is incorrectly reset to the default domain, it disrupts the entire site's functionality because URLs are no longer properly mapped to the correct language domains.

Key Findings:
Domain Settings Storage:

Language domains are stored in the language_domains setting in the WPML settings array. These domains are used by the WPML_URL_Converter_Domain_Strategy class to convert URLs between different language domains.

Domain Handling Methods:

In the current version, there are new methods in the SitePress class for handling domains:
get_domain_by_language()
is_language_domain_setting_enabled()
is_language_domain_setting_disabled()
get_default_domain()
These methods don't exist in the older version, suggesting they were added to improve domain handling.

Potential Issue:

- The problem likely occurs when the domain settings are being saved or updated.
- When a language is added or modified, the domain settings might not be properly preserved.
- The URL converter factory creates a domain converter that uses these settings, and if they're incorrect, URLs will be converted incorrectly.

Domain Validation:

There doesn't appear to be strong validation to ensure that domain settings remain consistent across language changes.
When a language is added or modified, the domain settings might be reset or not properly updated.

Possible Causes

Settings Persistence Issue:

When updating language settings, the domain settings might not be properly saved or might be overwritten.

Domain Initialization Problem:

When initializing the URL converter, if the domains aren't properly loaded, they might default to the main domain.

Language Switching Side Effects:

When switching languages or updating language settings, there might be side effects that reset domain configurations.

Cache Inconsistency:

The URL converter uses caching to improve performance. If the cache isn't properly invalidated when domain settings change, it might use outdated domain information.
Recommended Solution Approach

To fix this issue, I would recommend:

Improve Domain Settings Persistence:

Ensure that domain settings are properly saved and not overwritten during language updates.
Add validation to prevent domain settings from being reset unintentionally.

Add Domain Validation:

Implement validation to ensure that domain settings remain consistent and valid.
Add checks to prevent domains from being reset to the default domain unless explicitly requested.

Review Cache Invalidation:

Ensure that caches are properly invalidated when domain settings change.
This would prevent outdated domain information from being used.

April 9, 2025 at 5:43 pm #16915301

audriusL

get_domain_by_language()
is_language_domain_setting_enabled()
is_language_domain_setting_disabled()
get_default_domain()

These methods don't exist in the older WPML version and it's worth to review them to find the cases when domain is reset to the default.

April 10, 2025 at 1:41 pm #16918926

audriusL

Finally we have found how to replicate the problem. It happens when page is edited with a builder and not in a default language. After saving the page, the domain is switched to default one.

1. Go to WP Pages.
2. Switch default language (e.g. English) to another one (e.g. Lithuanian).
3. Choose to edit with not Gutenberg editor. (e.g. Edit with Bricks)
4. Make an edit, save page.
5. Language domain has been changed to a default.

bug.png
April 14, 2025 at 8:27 am #16927791

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I was able to replicate the issue on your hidden link">test site, so I consulted our second-tier support team. I'll update you as soon as they reply.

Best regards,
Osama

April 17, 2025 at 7:07 am #16942099

audriusL

Are there any news for me? Because when we get an order, domain also is reset to the default one.

April 17, 2025 at 9:05 am #16942882

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

The ticket has been escalated to our 2nd tier support team. I'll update the ticket with your findings and update you as soon as they reply.

Best regards,
Osama

April 17, 2025 at 1:24 pm #16944161

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Our 2nd tier support team found that the problem is in \Hostinger_Temporary_Domain_Handler::replace_in_array_recursive in wp-content/mu-plugins/hostinger-preview-domain.php
The method is called by Hostinger_Temporary_Domain_Handler::replace_host_in_option in the same file, which recursively replaces our option and updates the current domain to the one set as siteurl.

Best regards,
Osama

April 17, 2025 at 3:24 pm #16944937

audriusL

Hostinger... Removed their script and everything started to work as it should be. Thank you.