Skip Navigation

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

Problem:
You are trying to add new custom language pairs using country codes instead of language ISO codes in WPML.
Solution:
Unfortunately, it is not possible to delete pre-configured languages or add a custom language using the same language code. However, you can modify existing languages. Here are the steps you should follow:
1. Activate the language with the desired language code.
2. Update the language name translations, flag, default locale, hreflang, and language mapping.
For detailed instructions on how to edit languages in WPML, please visit Editing WPML's Languages Table.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. We also 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. For further assistance, please contact us through the 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.

Tagged: 

This topic contains 9 replies, has 0 voices.

Last updated by Andrey 3 weeks, 1 day ago.

Assisted by: Andrey.

Author Posts
May 12, 2025 at 12:47 pm #17023082

victorB-30

Background of the issue:
I am trying to add new custom language pairs using country codes instead of language ISO codes on my site hidden link.

Symptoms:
No specific issue or error message mentioned.

Questions:
How can I add custom language pairs using country codes in WPML?

May 12, 2025 at 7:08 pm #17024471

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for contacting WPML support.

Could you please upload any relevant screenshots or links that may help clarify your question? I want to ensure I fully understand the issue so I can provide the best possible solution.

For instructions on how to add languages in WPML, please refer to the following link: https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/.

May 13, 2025 at 7:14 am #17025355

victorB-30

What i was initially trying was to add more languages but instead of them using language code (en) for the pairs to use country code (uk).

As I need the url structure to be:

example.com/uk/ ---> English
example.com/ca/ ---> English (Canada)
example.com/tr/ ---> Turkish
example.com/au/ ---> Australia

But for example English is already pre selected and therefore I cannot add it again, even though it would be with a different pair.

How can I create the above architecture?

May 13, 2025 at 7:14 am #17025356

victorB-30

What i was initially trying was to add more languages but instead of them using language code (en) for the pairs to use country code (uk).

As I need the url structure to be:

example.com/uk/ ---> English
example.com/ca/ ---> English (Canada)
example.com/tr/ ---> Turkish
example.com/au/ ---> English

But for example English is already pre selected and therefore I cannot add it again, even though it would be with a different pair.

How can I create the above architecture?

May 13, 2025 at 7:22 am #17025370

victorB-30

For example, if I want to have United Kingdom (uk) it gives an error that the code already exists, this is due to the fact the it is confusing the country code with country language of ukraine, also (uk).

Thank you

Screenshot 2025-05-13 082137.png
May 13, 2025 at 8:54 am #17025984

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for the explanation.

It is impossible to delete pre-configured languages with their language codes or to add a custom language using the same language code; however, you can change them.

Here are the steps:

1. Activate the Ukrainian language.
2. Update the language name translations, flag, default locale, hreflang, and language mapping.

I hope this helps.

May 13, 2025 at 11:15 am #17026911

victorB-30

Hi,

Thank you for the feedback.
But then I am no able to change the Ukranian Language name to "United Kingdom".
Or does this happens somewhere else?

I need to have these custom pairs for quite a few countries and many of the reuse the english language. (Canada, USA, Australia, Ireland...).

Any other less "hacky" way of achieving this?

May 13, 2025 at 2:32 pm #17028517

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Thank you for your feedback.

But then I am no able to change the Ukranian Language name to "United Kingdom".
Or does this happens somewhere else?

Yes, however, the name shouldn't appear anywhere else. The language switcher will show the names you added.

I need to have these custom pairs for quite a few countries and many of the reuse the english language. (Canada, USA, Australia, Ireland...).

Any other less "hacky" way of achieving this?

Unfortunately, there is no alternative. I cannot recommend any changes directly to the database as it may lead to potential issues that I cannot predict.

May 14, 2025 at 8:53 am #17031059
victorB-30

Hi,

Thank you for your help.

I have made the changes and it seemed to have worked.

but now after translating a page into on the the countries I get a 500 error if I select the laguages in the wordpress bar under WPML.

It does not let me access the languages configurations to add/remove or edit.

thank you

New threads created by Andrey and linked to this one are listed below:

https://wpml.org/forums/topic/split-i-get-a-500-error-if-i-select-the-laguages-in-the-wordpress/

May 14, 2025 at 2:04 pm #17032841

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

Hello,

Thank you for your feedback.

It could be something else. Let me create a new support ticket for this issue.

I will reply here: https://wpml.org/forums/topic/split-i-get-a-500-error-if-i-select-the-laguages-in-the-wordpress/