[Resolved] Hreflang: Incorrect Language & Region Codes
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing issues with incorrect hreflang tags for languages on their website, specifically with the Norwegian language code, which is incorrectly set as 'nb-nb' instead of the standard 'no'. This issue affects the website's SEO as hreflang tags are crucial for multilingual websites to signal the language and regional URL variations to search engines. Solution: We reviewed the source code of the client's website and identified that all languages except Norwegian were using the correct hreflang tags. The Norwegian language should use the standard 'no' code instead of 'nb-nb'. If the client has created a custom Norwegian language, we recommend switching to the default language settings provided by WPML, as the custom setting conflicts with the standard language codes. To update the language codes in WPML: 1. Navigate to the WPML > Languages page. 2. Under the 'Edit Languages' section, find the incorrect 'nb-nb' entry. 3. Replace 'nb-nb' with 'no' and save the changes.
If this solution does not resolve the issue or seems outdated, or if it does not apply to your specific case, please visit our support forum to open 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.
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.
Background of the issue:
I am trying to fix hreflang language issues on my website using the WPML plugin. The hreflang tag is generated by a multilingual plugin, not by the Yoast SEO plugin. I was advised to review a guide on hreflang and ensure the language codes are appropriate. I am using the WPML plugin and need help fixing the hreflang language issues. There should be a way to update the language in the WPML plugin. Link to a page where the issue can be seen: hidden link (site-wide problem)
/Yoast Support/
Thanks for getting in touch with the Yoast support team.
We would like to let you know that the hreflang tag is actually generated by a multilingual plugin and not by the Yoast SEO plugin. We recommend reviewing this guide to ensure you are not missing anything: hreflang: The ultimate guide.
Since you are using WPML plugin, please get in touch with them to help fix the hreflang language issues. You can also ensure that the lang is appropriate with these codes: hidden link
There should be a way to update the language in WPML plugin.
Symptoms:
The hreflang tags have incorrect language and region codes, affecting SEO.
Questions:
How can I fix the hreflang language issues using the WPML plugin?
Is there a way to update the language codes in the WPML plugin?
- All languages are using the correct hreflang except for "nb-nb".
- This language is not a default WPML language, and I even see that the proper Norwegian language "no" is present in your debug info.
Did you create a second/custom Norwegian language?
I would recommend to use our default language which is correctly set up because you won't be able to use "no" for your custom language as it's already registered.
Yea, about nb i know. And thats not problem right now.
I made a video so you can see what i mean. hidden link
/* Frog program*/
Description
URLs with hreflang annotations that contain invalid language (in ISO 639-1 format) and or optional regional (in ISO 3166-1 Alpha 2 format) values. Unsupported hreflang values can be viewed in the lower window 'URL Details' pane with an 'invalid' status.
How To Fix
Update hreflang annotations to include valid language and regional values, so they can be used for geotargeting the right audiences appropriately.
Thanks for the video, it confirms that the issue encountered is the one I reported.
Let me explain:
- Your Norwegian language is using an incorrect language code "nb-nb"
- On all pages in all languages, you will have in the source code links to all translations (hreflang links).
- That's why the issue is reported even on Polish or English pages.
- That's because the Polish and English pages will contain a link to the problematic Norwegian language.
I took a screenshot of your video, when scanning the English homepage, in the bottom left part you can see that the "nb" language is invalid, while all other languages are valid.
Switching to our default Norwegian language "no" should fix this issue.