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.