This thread is resolved. Here is a description of the problem and solution.
Problem: You are using the WPML SEO plugin and have noticed that HREFLANG tags are not being automatically added to the HTML head section of your site. Solution: We have updated the WPML SEO plugin to version 2.2.0, which now includes HREFLANG tags directly in the sitemaps instead of the HTML head section. This change improves SEO by simplifying your site's HTML. You can confirm that the HREFLANG tags are correctly implemented in your sitemaps by checking your site's page source. For more details on this update, please visit WPML SEO 2.2.0 documentation.
If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. We also highly suggest 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 visit our support forum 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.
I need to request temporary access (wp-admin and FTP) to your site—preferably to a test site where the problem has been replicated if possible—in order to be of better help. When you log in to leave your next reply, you will find the needed fields below the comment area. The information you will enter is private, meaning only you and I can see and access it.
If I need to debug the problem further, I would like to ask about the possibility of replicating your site locally. I'll need to install a "Duplicator" temporarily or an "All In One Migration" plugin on your site. This will enable me to create a duplicate of your site and its content. If you prefer to do it independently, you can provide the snapshot and send me the zipped package you downloaded.
I have double-checked, and the hreflang tags are present in your site in the sitemaps. I have attached a screenshot for your review. Alternatively, you can check it hidden link">here.
You can check the latest released versions under "My Account -> Downloads" on this site. Instructions to update can be found here: http://wpml.org/faq/install-wpml/
If you do not see the updates, you might need to click the Check for updates button in the Plugins → Add New Plugin → Commercial tab.
If the issue persists after an update has been done, please compare your staging site and live, as I can see the hreflangs there. I only had to update the WPML SEO plugin there.
Please remember to back up your database before you proceed.
I have updated the WPML SEO plugin, but it still does not fix the problem.
If you only updated the plugin yourself, than live and staging should be exactly the same. I have pushed live to staging again to update the staging.
The difference I see:
on staging:
<urlset xmlns:xsi="hidden link" xmlns:image="hidden link" xsi:schemaLocation="hidden linkhidden linkhidden linkhidden link" xmlns="hidden link" xmlns:xhtml="hidden link">
I have re-examined the link hidden link, comparing it to the staging site, and it is missing the pages.
Please try to go to Rank Math using Rank Math’s WordPress menu. Hover over the menu with your mouse, and then click the Sitemap Settings. Check if nothing is missing.
If the issue persists, I would need access to your live site. I am not certain why it doesn't work on the live site. The following reply is private.
You have pointed me in the right direction, I have changed a settings in RankMath, to not include images, and that must have triggered the recreation of the sitemaps, WITH the hreflangs. I enabled index images, and the sitemap still showed the hreflangs.