Skip Navigation

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

Problem:
You are trying to add a language switcher to the right side of the top bar on your site using WPML, but when you use the shortcode

[wpml_language_selector_widget]

, it displays as a text string instead of rendering the language switcher.
Solution:
The issue might be that the PHP code necessary to execute the shortcode is not running in the widget or custom area where you are trying to add it. This could be due to the code being added in the WordPress backend rather than directly in the theme files. We recommend trying to add the shortcode

[wpml_language_selector_widget]

directly into your theme files where you want the language switcher to appear. If you are not sure how to do this, please refer to our documentation on Adding Language Switchers using PHP and Shortcodes.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your specific 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 you still need assistance, please open a new support ticket in our 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.

Tagged: 

This topic contains 2 replies, has 0 voices.

Last updated by marekC-15 1 week, 2 days ago.

Assisted by: Mihai Apetrei.

Author Posts
February 3, 2025 at 9:47 pm #16664578

marekC-15

Background of the issue:
I'm trying to put a language switcher in the right side of the top bar on my site hidden link. I'm following the documentation at https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/adding-language-switchers-using-php-and-shortcodes/?utm_source=plugin&utm_medium=gui&utm_campaign=languages. I'm pasting different code in the 'content right' field.

Symptoms:
The code I paste adds a string of text instead of a working language switcher.

Questions:
How can I correctly add a language switcher to the top bar using WPML?

February 3, 2025 at 10:57 pm #16664655

Mihai Apetrei
Supporter

Languages: English (English )

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

Hi there.

It looks like the PHP code is not running for that widget/custom area.

You probably did not add it to the theme code, but it was added somewhere in the WordPress backend.

Try to use a shortcode instead, as mentioned on that same documentation page you mentioned:

[wpml_language_selector_widget]

Please let me know if that works.

Mihai Apetrei

February 4, 2025 at 8:27 am #16665197

marekC-15

Unfortunately, adding the shortcode [wpml_language_selector_widget] results in the top bar displaying the string "[wpml_language_selector_widget]" instead.

I've tried editing functions.php, woostify-template-functions.php, and header.php with no success.

Worth to add, my theme is woostify

February 4, 2025 at 9:06 am #16665421

marekC-15

it turned out that backup was done on my website and wpml got turned on. now everything works with shortcode