Skip to content Skip to sidebar

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
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Vienna (GMT+01:00)

Tagged: 

This topic contains 10 replies, has 0 voices.

Last updated by Lucas Vidal de Andrade 5 days ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
October 16, 2025 at 2:00 pm

ericS-67

Background of the issue:
I was trying to use the language switcher on the mobile menu to display different language flags and the name of the language to select.

Symptoms:
The language switcher on the mobile menu is only showing a piece of coding instead of the expected language flags and names.

Questions:
Why is the language switcher showing a piece of coding instead of language flags?
How can I fix the language switcher to display the correct language options?

October 20, 2025 at 5:45 pm #17500573

ericS-67

WIP

October 20, 2025 at 6:20 pm #17500671

ericS-67

Ok so I tried to install the theme and the plugins but I got some errors while installing. Maybe this was because the WPML plugins were allready activated. Could you reset the sandbox website please so I can try again and disable the plugins first.

October 28, 2025 at 2:57 pm #17526613

ericS-67

Very strange, I get errors when trying to install the demo-content of the theme I used to make my website. Can you reset the website one more time? Then I will deselect every plugin that is possible to deselect when installing the demo content.

October 31, 2025 at 10:31 am #17535467

ericS-67

Hi, Ok so the error happened again when I tried to import the demo content. Can you please check the debug log? See the top side of the screenshot. And after that it didn't load further then 70%...

I tried to replicate all the settings but now the items of the top menu don't show...

Screenshot 2025-10-31 at 11.12.27.jpg
October 31, 2025 at 10:36 am #17535502

ericS-67

Update: I added a language switcher in the footer on vdl-pearls.com and that works good on the mobile. Maybe this will help you with finding the problem/solution.

November 3, 2025 at 10:12 am #17540254

Lucas Vidal de Andrade
WPML Supporter since 11/2023

Languages: English (English )

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

Hey there,

Thanks for sharing. I was able to reproduce the issue on the Sandbox without the demo content, please leave it as it is. I've forwarded the ticket to our 2nd tier team and will get back to you once I hear from them, what usually takes a few days.

Thank you.

November 4, 2025 at 8:44 am #17544245

Lucas Vidal de Andrade
WPML Supporter since 11/2023

Languages: English (English )

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

Hello,

Thank you for waiting. We were able to pinpoint the issue with the theme. It bypasses wp_nav_menu() and its walkers, grabs raw items via wp_get_nav_menu_items(), and rebuilds its own HTML. That custom markup breaks the language switcher.

To fix it, ensure to have a backup and follow the steps below.

1. Open the ...partials/headers/parts/mobile_menu.php file.
2. Around for line 17, right below the line:

foreach ( (array) $menu_items as $key => $menu_item ) {

3. Add the following:

					// Detect WPML LS with class 'wpml-ls-item' 
					$classes = is_array( $menu_item->classes ) ? $menu_item->classes : array(); 
					if ( in_array( 'wpml-ls-item', $classes, true ) ) { 
						$menu_list .= '<div class="stm_lms_categories_dropdown__parent">'; 
						$menu_list .= do_shortcode( '[wpml_language_switcher]' ); 
						$menu_list .= '</div>' . "\n";
						continue; 
					}

That should solve it.

Another workaround would be to use a custom language switcher (instead of the menu language switcher) and add it manually to the theme templates:

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/

November 4, 2025 at 10:30 am #17544788

ericS-67

Thank you!!!

If you look at my attachment you can see there are 2 times the options to choose the language and it is not a fold-out menu like in the desktop version and there are no flags. Can this be fixed?

And do I need to send this fix to MasterStudy as well so they can implement it in future updates you think?

Thanks!

IMG_1407.jpg
November 4, 2025 at 4:22 pm #17546978

Lucas Vidal de Andrade
WPML Supporter since 11/2023

Languages: English (English )

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

I'll check that with 2nd tier and will let you know. Thanks for the patience so far.

November 5, 2025 at 3:49 pm #17551139

Lucas Vidal de Andrade
WPML Supporter since 11/2023

Languages: English (English )

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

Problem fixed. I tweaked the code we share earlier and now everything should be correct. Let me know.