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: Africa/Cairo (GMT+02:00)

Tagged: 

This topic contains 4 replies, has 0 voices.

Last updated by Osama Mersal 3 hours, 19 minutes ago.

Assisted by: Osama Mersal.

Author Posts
February 12, 2025 at 4:08 am #16693995

veraB-9

Background of the issue:
I am developing a site and want to enable switching the WordPress account interface to the user's language of preference using WPML.

Symptoms:
When a user registers with a non-English language and logs into their control panel, the interface is still in English.

Questions:
How can I enable the WordPress account interface to switch to the user's preferred language?

February 12, 2025 at 11:51 am #16696186

Osama Mersal
Supporter

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

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

Hi,

Thanks for contacting WPML forums support. I'll be glad to help you today.

1) Please go to Users -> Profile, change the language using the language dropdown menu, and update the profile.

2) Could you please share your Debug information with me?
You can read a detailed explanation about it here. (http://wpml.org/faq/provide-debug-information-faster-support)
The debug info will give me much information about how your site is configured.

Best regards,
Osama

February 13, 2025 at 11:51 am #16701597

veraB-9

none

Screenshot 2025-02-13 at 7.45.05 PM.png
Screenshot 2025-02-13 at 7.44.51 PM.png
Screenshot 2025-02-13 at 7.42.41 PM.png
Screenshot 2025-02-13 at 7.42.59 PM.png
February 13, 2025 at 12:07 pm #16701779

Osama Mersal
Supporter

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

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

Hi,

Please share a screenshot of the language field inside the Profile edit screen.

Best regards,
Osama

2025-02-13_14-05-47.png
February 14, 2025 at 9:39 pm #16708064

veraB-9

Thank you, Osama.

I am including the screenshots (language field as well). The particular test story is:

1) a new user registers choosing Russian language (using WPML-provided switch on the bottom of the registration page)

2) subsequent login reveals English interface of the WP account

3) the language in the language field inside the Profile edit screen is also English

So, the language information chosen by a user is not being transmitted

Thank you!

WhatsApp Image 2025-02-14 at 21.26.44.jpeg
WhatsApp Image 2025-02-14 at 21.26.36.jpeg
WhatsApp Image 2025-02-14 at 21.26.22.jpeg
February 15, 2025 at 1:23 pm #16708985

Osama Mersal
Supporter

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

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

Hi,

Thanks for your update. I would need to look closely at your site, so I would need to request temporary access (WP-Admin and FTP)
Preferably to a test site where the problem has been replicated.

Your answer will be private, meaning only you and I can access it.

❌ Please backup your database and website ❌

✙ I need your permission to deactivate and reactivate the plugins and themes and change site configurations. This is also why the backup is critical.

✙ I also need your permission to take a local copy of your site to debug the issue without affecting your live site.

Best regards,
Osama

February 16, 2025 at 4:40 pm #16711033

Osama Mersal
Supporter

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

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

Hi,

Thanks for the access details. Please check the provided account capabilities, as I can't install a new plugin to take a local package.

Thanks,
Osama

February 18, 2025 at 2:40 pm #16719667

veraB-9

Thanks, Osama.

Our developer told me that there are differences (hardwired in WordPress) in privileges between different users assigned to "Administrator" roles, with the main user with ID1 still having more privileges. I've assigned your account the highest privilege possible (Administrator). If this does not work for a particular purpose, the least troublesome way would be for me to install the required plugin for you. What is the plugin address?

Thank you!

February 19, 2025 at 8:25 am #16722637

Osama Mersal
Supporter

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

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

Hi,

Thanks for your update. Please install this hidden link">plugin, create a backup, and let me know to download it.

Thanks,
Osama

February 20, 2025 at 11:20 pm #16731750

veraB-9

Thank you, Osama.

Done!

Screenshot 2025-02-21 at 7.07.45 AM.png
Screenshot 2025-02-21 at 7.05.22 AM.png
February 21, 2025 at 2:23 pm #16734098

Osama Mersal
Supporter

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

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

Hi,

Thanks for creating the package. I installed a local copy of your site and was able to fix the issue by adding the following code to the functions.php file.

add_action('user_register', function($user_id) {
    $current_language = function_exists('wpml_get_current_language') ? wpml_get_current_language() : get_locale();

    if (!empty($current_language)) {
        update_user_meta($user_id, 'locale', $current_language);
        remove_action('personal_options_update', 'wpml_update_user_locale'); 
        wp_update_user([
            'ID'     => $user_id,
            'locale' => $current_language
        ]);
    }
}, 20);

Please note that this custom code is a courtesy and is not officially supported by the WPML team. Please test it in a staging environment before applying it to a live site.

Best regards,
Osama

February 25, 2025 at 1:16 pm #16745958

veraB-9

Thank you, Osama.

The code is implemented and we are much closer to completeness.

Still, there are peculiarites of how the language switches function acroiss the site and contexts.

We have 3 types of language switches (screenshots with the respective numbers in filenames):

1) main top switch on the frontpage / other content pages of the site;
2) switch in the user settings of the dashboard (WP native one)
3) top switch in the dashboard

What is happening is that switch #1 works fine on the sites content but does noty affect the dashboard
Switch #2 changes the user's language environment in the dashboard
Switch #3 helps ADMINS to navigate multi-langauge content in the dashboard (it is not helpful to the regular user, though).

So, the ideal world solution would be to have switch #1 as a "Master Switch" to affect everything, from site content to the dashboard environment. But we realize this may or may not be possible. Given the current functionality, hiding the switch #3 from a regular user (not admin) may be a working solution. Or maybe we are missing something and you can suggest a better solution?

Thank you!

Location_1.png
Location_3.png
Location_2.png
February 25, 2025 at 1:26 pm #16746069

Osama Mersal
Supporter

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

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

Hi,

1) This front-end language switcher only works on the front-end content.

2) This is not a language switcher; it's an option that says which language the strings of the dashboard will appear to that user. It's unrelated to the content, pages, posts, products, etc.

3) This dashboard language switcher switches the language in the dashboard to see different content in different languages.

The front-end language switcher can't be a master switcher for the front-end and dashboard.

Best regards,
Osama

February 26, 2025 at 10:17 am #16750195

veraB-9

Thank you, Osama.

To our latter question from the previous message ("hiding the switch #3 from a regular user (not admin)") - this may improve useability for the confused regular user. Could you suggest a way / a script to hide the top language switch in the dashboard from the regular (non-privileged) user?

Thank you always!

February 26, 2025 at 10:54 am #16750556

Osama Mersal
Supporter

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

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

Hi,

There is no setting for hiding it, but you can write a function to achieve that. I'm afraid we don't have one ready for that.

Best regards,
Osama