Home›Support›English Support›[Resolved] Theme-Options strings (emails + frontend texts) force the back-end into the wrong language and email...
[Resolved] Theme-Options strings (emails + frontend texts) force the back-end into the wrong language and email...
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues with their multilingual website where the WordPress admin interface changes to the language of the first front-end visitor, affecting the language of emails sent, which do not match the user's preferred language. All Theme-Options strings are registered under the domain admin_texts_jws_option, and translating a string causes the admin UI to switch languages and remain in that language. Solution: To address the issue of the admin interface changing languages and affecting email language settings, follow these steps: 1. Ensure you have a full backup of your website. 2. Navigate to Plugins > Plugin File Editor and select the "LoveDate Core" plugin. 3. Open the file "redux-core/inc/classes/class-redux-options-constructor.php". 4. Locate the following code:
public function __construct( $parent ) {<br /> parent::__construct( $parent );<br /> add_action( 'admin_init', array( this, 'register' ) );<br />}
5. Replace it with:
public function __construct( $parent ) {<br /> parent::__construct( $parent );<br /> add_action( 'current_screen', array( this, 'register' ) );<br />}
6. Save the changes. This modification should prevent the admin interface from switching languages based on the front-end visitor's language, thereby ensuring emails are sent in the correct language. Note that this solution involves custom code modification, which is not officially covered by WPML support.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable 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 further assistance is needed, please open a new support ticket at WPML 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.
Background of the issue:
I am trying to translate every Theme Options string so that on the frontend, the visitor sees the texts in the language they selected (EN, PT, or ES). I also want every email to be sent in the correct language and keep the WordPress admin dashboard permanently in English. I followed the WPML guide for multilingual emails: https://wpml.org/documentation/support/sending-emails-with-wpml/. I verified the mail function calls: do_action('wpml_switch_language_for_email', $to); wp_mail($to, $subject, $body, $headers); do_action('wpml_reset_language_after_mailing'). The issue can be seen here: hidden link.
Symptoms:
All Theme-Options strings are registered under the domain admin_texts_jws_option. When I translate a string, WPML switches the entire admin UI to the language of the first front-end visitor and keeps it that way. Every subsequent email is sent in that same forced language, ignoring each user’s preferred language. Frontend texts may appear translated, but the admin locale is wrong. Emails are never sent in the correct user language—only in the forced admin language.
Questions:
How can I ensure that the admin interface remains in English regardless of the visitor's language?
How can I make sure that emails are sent in the correct user's language instead of the forced admin language?
I was able to understand the issue, checking the example you shared in the video. To test if this is a compatibility issue between the child theme custom implementation and WPML, I've created a test environment for us:
hidden link
You can access it by clicking on the link above. The idea is to check how the theme behaves with WPML, in isolation, with no external influences (like other plugins or content). The environment is set in EN as default and ES as secondary, which is enough.
Please install your theme and try to recreate the issue there. Don't forget to add related custom code (if there's any). Let me know how it goes or if you have any questions.
The idea here is to check the theme and its customizations in isolation, so please do not create a copy of the entire website there. Creating a copy is actually the opposite of what we want.
Please recreate your issue, using only your theme and other plugins that are directly related to the email issue you brought. If there are no plugins related to the feature that presents the issue, don't install any. By checking your theme in isolation, I can understand if the issue is being caused by the customizations, or by something else. Let me know your results.
It seems to me that you haven't reproduced the issue exactly as it is on the live website, on the sandbox. The theme that has the customizations "LoveDate Child" is not installed in the Sandbox. Since we don't know exactly what's causing the behavior, I need to check the issue itself, not something similar to it.
I need to look at the exact code, in the very same exact theme that you're using on your live website. Please follow these instructions exactly as they're here:
1. Log into to your hosting and access your file manager;
2. Create a zip of your Parent theme (LoveDate), in wp-content/themes/;
3. Create a zip of your Child theme (LoveDate Child), in wp-content/themes/;
4. Download the zip files (which are the themes themselves);
5. In the sandbox, go to Appearance > Themes > Add New and upload the zip file for the parent theme;
6. In the sandbox, go to Appearance > Themes > Add New and upload the zip file for the chilf theme;
7. Activate the child theme
8. Recreate the issue of the page you showed in the first video (check image attached). Let me know how it behaves.
I will focus only on this issue at the moment (not on the email one). They're likely related - I will confirm about the email later. Please follow the steps exactly as they're listed above. Avoid trying to interpret what I'm sending in other ways other than what's explicitly written in the instructions, to avoid misunderstandings. Thank you.
I see that there are many pages and plugins installed on the Sandbox, that are not directly related to the issue, which is the opposite of what we need at the moment. Besides that, WPML was already set up, so it seems to me something was overwritten.
As I said, we need to check the issue in ISOLATION. I'll re-investigate everything to see if I can work on the issue without you recreating it. I'll let you know.
Please DO NOT make any changes to the Sandbox. Thank you.
I'll need to access your website directly. Please share access.
The required fields can be found below the comments section. The information you enter is private, i.e. only you and I can see it and have access to it.
I may need to replicate your website locally. To do this, I need to temporarily install a plugin called "Duplicator" or "All in One WP Migration" on your website. This will allow me to create a copy of your website and content. Once the issue is resolved, I will delete the local website. Let me know if this works for you.
IMPORTANT
Please make a backup copy of the site files and database before giving us access.
- If you do not see the wp-admin/FTP fields, this means your post and site login details are being made PUBLIC. DO NOT post your website details if you do not see the required wp-admin/FTP fields. If you do not, ask me to enable the private box. The private box looks like this:
Thanks for sharing. I'm still checking your issue. I still couldn't find exactly what's causing that behavior and will get back to you once I have new information. Thank you for your patience.
Since your website has a rather complex custom implementation, we decided to focus on a more simple scenario to understand the issue better and to be able to debug more productively. We focused on the profile issue, where visiting the page on a secondary language, changed default values. As shown here:
hidden link
To fix that, please make sure to have a full website backup and follow the steps:
1. Go to Plugins > Plugins File Editor and select the plugin "LoveDate Core" plugin;
2. Select the "redux-core/inc/classes/class-redux-options-constructor.php" file;
3. Find
public function __construct( $parent ) {
parent::__construct( $parent );
add_action( 'admin_init', array( $this, 'register' ) );
}
replace it with:
public function __construct( $parent ) {
parent::__construct( $parent );
add_action( 'current_screen', array( $this, 'register' ) );
}
and save. The final result should be similar to the image attached;
That fixes the issue. I've tested that on a copy of your website and was able to confirm.
Please note that this falls under custom work and is not officially covered by our support. This is not an issue on WPML, but on the custom code. The site’s content language is unintentionally changed because translation strings are being re-registered in the language of the current visitor — this happens due to custom code that shouldn't run on the front end.