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.

This topic contains 1 reply, has 2 voices.

Last updated by Marsel Nikolli 1 year, 4 months ago.

Assisted by: Marsel Nikolli.

Author Posts
September 27, 2023 at 11:53 am #14473651

cedricB-24

Tell us what you are trying to do?
Hi there,
I need to replace the language code /en/ by /gb/.

I want my english urls to be like mywebsite.fr/gb/something instead of mywebsite.fr/en/something

I can't edit the "code" in language. When I removed the english language (my main/default language is french) and tried to add it with the "gb" code, I got a notification telling me the same language already exist.
Is it because I selected "english" in the mapping? How can I archive that though?

Thanks in advance for your help,

Cédric

FireShot Capture 3087 - Langues ‹ JOJO Factory — WordPress - in-my-world.com.jpg
September 28, 2023 at 9:01 am #14479973

Marsel Nikolli

Hi Cédric,

Thank you for contacting WPML Support.

First in order to switch your website back to English you need to:
1. Go to WPML->Language->Edit languages
2. For the "English" language change the "Default locale" and "hreflang" to "en_US" and save

The language code cannot be changed after a language has been added.

However, you can create a new "custom" language with the desired language code.

1. Go to WPML->Language->Edit languages

2. Add a new custom language with the custom language code ("gb" in your case)

3. Once it has been added you can now use the Translation Management dashboard to bulk duplicate from the "old" English to the "gb" English you just added

4. Remove the old language and start using the new custom one ("gb" English)

More detailed information is available in our guide as well:
https://wpml.org/faq/how-can-i-assign-or-change-language-code-to-existing-content/

NOTE: To use the same default locale you will need to first change the English default locale before adding the new language and saving.
Then add the original default locale to the new custom language.

Let me know your results, please.

Regards,
Marsel