Skip Navigation

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

Problem:
The client needed to change the hreflang of a custom Japanese language from 'jp' to 'ja' while maintaining the language code 'jp'. They encountered an error stating 'The hreflang already exists' because the default Japanese language was using 'ja', even though it was not enabled.
Solution:
1. Navigate to WPML->Languages and add the default language for Japanese. Pause automatic translation if it's active to prevent content creation in that language.
2. Click on "edit languages".
3. Change the hreflang for the default Japanese language from 'ja' to another value, such as 'ja-ja', and save the changes.
4. Refresh the page, then adjust the custom language setting from 'jp' to 'ja'. This should now allow the assignment of 'ja' as the hreflang.
5. Remove the default Japanese language since it is no longer in use.

If this solution does not resolve your issue, or if it seems outdated or irrelevant to your 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 further assistance is needed, please open a new support ticket at 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 1 reply, has 2 voices.

Last updated by Bobby 10 months ago.

Assisted by: Bobby.

Author Posts
July 1, 2024 at 11:19 pm #15870830

Nate

Background of the issue:
The secondary language of the site hidden link is Japanese. We created a new custom Japanese language code 'jp' to use /jp in the URLs instead of /ja. We need to change the hreflang of the 'new' Japanese language from 'jp' to 'ja' while maintaining the language code 'jp'.

Symptoms:
When we try to change the hreflang, we receive the error 'The hreflang already exists.' This is because the original default Japanese language is using it, even though it is not enabled.

Questions:
How can we change the hreflang from 'jp' to 'ja' for the Japanese language?
Is it possible to delete the default Japanese language so that the 'ja' hreflang is not being used?
Can we change the default Japanese language so that the 'ja' hreflang is not being used?

July 1, 2024 at 11:51 pm #15870883

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

Please follow these steps to use 'ja' as your Hreflang for the new custom language.

1. Go to WPML->Languages and add the default language for Japanese (if you are using automatic translation please make sure to pause it to avoid creating content in that language)

2. On the same page click on "edit languages"

3. Edit the hreflang for the default JA language and switch it from 'ja' to something like , 'ja-ja' for example and save.

4. Refresh the page, now adjust the custom language and change it from 'jp' to 'ja' , you should be able to assign it now and save.

5. Remove the default language for JA since you are no longer using it.

Let me know your results, please.

July 4, 2024 at 2:54 am #15888001

Nate

Thank you. That worked perfectly.