If you have multiple versions of a page in different languages or regions, help Google identify them. Search results will then show the versions of your pages that are best suited for the user’s language and region.
Google may find alternate versions of your pages even if you take no action, but it’s still a good idea to list them explicitly.
How to get the full URL and where to add the Hreflang tag?
We need to add the following PHP code to header.php:
$actual_link = “https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
$actual_link = rtrim($actual_link , ‘/’);
<link rel=”alternate” hreflang=”en-US” href=”<?=$actual_link?>/”>