{"id":103001,"date":"2020-05-04T09:39:55","date_gmt":"2020-05-04T14:39:55","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=resource&#038;p=103001"},"modified":"2024-09-29T11:19:16","modified_gmt":"2024-09-29T16:19:16","slug":"hreflang-tags-for-wordpress","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/hreflang-tags-for-wordpress\/","title":{"rendered":"How to Add hreflang Tags in WordPress"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2020\/05\/welcome-languages-1-1024x682-2.png\" alt=\"Effectively Implement hreflang in WordPress for improved SEO performance\" class=\"wp-image-103414\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/05\/welcome-languages-1-1024x682-2.png 1024w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/05\/welcome-languages-1-1024x682-2-300x200.png 300w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/05\/welcome-languages-1-1024x682-2-768x512.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Are you building a website that supports multiple languages and regions? A multilingual site can expand your potential audience exponentially, but can also seem difficult to manage.<\/p>\n\n\n\n<p>The good news is that adding hreflang tags can improve your site\u2019s Search Engine Optimization (SEO) and User Experience (UX). It\u2019s not that hard to accomplish, and you can start benefiting from increased traffic and engagement quickly.&nbsp;<\/p>\n\n\n\n<p>In this article, we\u2019ll look at what hreflang tags are, and some of the best practices for using them. We\u2019ll then reveal the methods you can use to implement these tags on your WordPress website. Let\u2019s get to work!<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">What is the hreflang tag in WordPress?<\/h2>\n\n\n\n<p>The <a href=\"https:\/\/moz.com\/learn\/seo\/hreflang-tag\">hreflang tag<\/a> is HTML code that tells Google which version of a web page to display for certain languages and regions. Here\u2019s an example of what that code can look like:&nbsp;<\/p>\n\n\n\n<p><code>&lt;link rel=\"alternate\" href=\"example.com\" hreflang=\"en-us\" \/&gt;<br>&lt;link rel=\"alternate\" href=\"example.com\/fr\/\" hreflang=\"fr-fr\" \/&gt;<\/code><\/p>\n\n\n\n<p>Each tag includes a combination of language and location details, such as \u201cen-us\u201d for English and the United States, or \u201cfr-fr\u201d for French and France.&nbsp;<\/p>\n\n\n\n<p>While Google can detect the language of a web page, not having hreflang tags can still harm your search rankings. That&#8217;s because without these tags, your pages in different languages can end up competing against each other for top placements. While hreflang tags are not ranking factors on their own, they do <a href=\"https:\/\/support.google.com\/webmasters\/answer\/189077?hl=en\" target=\"_blank\" rel=\"noreferrer noopener\">help Google serve the right pages<\/a> to users.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">hreflang and your multilingual site: Best practices<\/h2>\n\n\n\n<p>You can reach a wider audience with a WordPress multilingual website, but you need to implement certain best practices in order to get results. One of the best practices for this kind of website is to use hreflang tags, but there are other smart techniques as well.<\/p>\n\n\n\n<p>For the best user experience, it\u2019s smart to use content written by native speakers, and not machine-translated text. Another best practice is to use <a href=\"https:\/\/webmasters.googleblog.com\/2013\/04\/x-default-hreflang-for-international-pages.html\" target=\"_blank\" rel=\"noreferrer noopener\">the optional x-default tag<\/a> for unmatched languages. This should be used on home pages, where users can select the location and language they want.&nbsp;<\/p>\n\n\n\n<p>If your website <a href=\"https:\/\/moz.com\/learn\/seo\/canonicalization\">uses canonical tags<\/a>, you\u2019ll also need to be careful when adding hreflang tags. These two types of tags can conflict, sending mixed signals to Google about which page it should display. While you can leave the hreflang tags off pages that have canonical tags, it is better to simply add the language tags carefully.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to implement hreflang tags in WordPress<\/h2>\n\n\n\n<p>hreflang tags are invaluable on WordPress websites, but only when implemented correctly. There are three methods you can use to add these tags to your website. Plugins are the easiest and most common method. However, you can also update your website\u2019s header, or edit its XML sitemap. Let\u2019s look at all three techniques.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">hreflang WordPress plugins<\/h3>\n\n\n\n<p>The easiest method of hreflang implementation is to use a WordPress plugin. Plugins like <a href=\"https:\/\/wpengine.com\/solution-center\/multilingualpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">MultilingualPress<\/a> add hreflang tags for you automatically, and shouldn\u2019t cause any performance problems:<\/p>\n\n\n\n<p>MultilingualPress also has a translation feature, which can be found in the post editor. When you accept a translation, the plugin adds the appropriate hreflang tags to your site\u2019s header. The translation feature is not limited to posts, and works on tags and categories while also syncing up well with plugins like Yoast and WooCommerce.&nbsp;<\/p>\n\n\n\n<p>Another plugin option for hreflang implementation is <a href=\"https:\/\/wpengine.com\/solution-center\/polylang\/\" target=\"_blank\" rel=\"noreferrer noopener\">Polylang<\/a>:<\/p>\n\n\n\n<p>Polylang is a popular free tool that helps you manage WordPress websites in multiple languages. You can create content as usual, and then assign a language to it. After that, Polylang will take care of the hreflang tags for you.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add hreflang to &lt;head&gt;<\/h3>\n\n\n\n<p>You can add hreflang tags to your WordPress website without a plugin, by updating your <em>header.php<\/em> file. To access this file, you\u2019ll need to navigate to <em>Appearance<\/em> &gt; <em>Theme Editor<\/em>, or <a href=\"https:\/\/wpengine.com\/support\/sftp\/\" target=\"_blank\" rel=\"noreferrer noopener\">use File Transfer Protocol (FTP)<\/a>.<\/p>\n\n\n\n<p>After opening the file, you\u2019ll want to look for the <em>&lt;head&gt;<\/em> opener and paste in this code:<\/p>\n\n\n\n<p><code>&lt;link rel=\"canonical\" href=\"http:\/\/example.com\/content\"\/&gt;<br>&lt;link rel=\"alternate\" hreflang=\"x-default\" href=\"http:\/\/example.com\/content\"\/&gt;<br>&lt;link rel=\"alternate\" hreflang=\"en-us\" href=\"http:\/\/example.com\/content\"\/&gt;<br>&lt;link rel=\"alternate\" hreflang=\"es-es\" href=\"http:\/\/example.com\/es\/content\"\/&gt;<br>&lt;link rel=\"alternate\" hreflang=\"fr-fr\" href=\"http:\/\/example.com\/fr\/content\"\/&gt;<\/code><\/p>\n\n\n\n<p>In this example, the tags need to be added to the English language content. The x-default and English hreflang tags also point to the English content page.<\/p>\n\n\n\n<p>On the other hand, the Spanish and French hreflang tags redirect to the correct language versions of the page. Of course, you can add more hreflang tags for any other languages used on your website.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add hreflang to your WordPress XML sitemap<\/h3>\n\n\n\n<p>If you don\u2019t want to edit your <em>header.php<\/em> file, you can update <a href=\"https:\/\/wpengine.com\/resources\/xml-sitemap-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">your site\u2019s XML sitemap<\/a> instead. Using this method ensures that Google will find your alternate-language pages and index them properly. Updating your sitemap also reduces the size of your web pages, for faster loading times.<\/p>\n\n\n\n<p>The hreflang tags for your XML sitemap are slightly different:<\/p>\n\n\n\n<p><code>&lt;url&gt;<br>&lt;loc&gt;http:\/\/www.example.com\/content&lt;\/loc&gt;<br>&lt;xhtml:link rel=\"alternate\" hreflang=\"es-es\" href=\"http\/\/www.example.com\/es\/content\"\/&gt;<br>&lt;xhtml:link rel=\"alternate\" hreflang=\"fr-fr\" href=\"http\/\/www.example.com\/fr\/content\"\/&gt;<br>&lt;\/url&gt;<br>&lt;url&gt;<br>&lt;loc&gt;http:\/\/www.example.com\/es\/content&lt;\/loc&gt;<br>&lt;xhtml:link rel=\"alternate\" hreflang=\"en-us\" href=\"http\/\/www.example.com\/content\"\/&gt;<br>&lt;xhtml:link rel=\"alternate\" hreflang=\"fr-fr\" href=\"http\/\/www.example.com\/fr\/content\"\/&gt;<br>&lt;\/url&gt;<\/code><\/p>\n\n\n\n<p>While editing your XML sitemap helps with indexing, it can also become complicated. If you have a large website, the sitemap may become bloated. Adding hreflang tags to the sitemap can also take longer than using other methods described above.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to validate hreflang in WordPress<\/h2>\n\n\n\n<p>Even when they\u2019re included, hreflang tags are often implemented incorrectly on multilingual websites. Validating your hreflang tags can help you determine if you have added them correctly.<\/p>\n\n\n\n<p>To validate the tags, you can use various online tools. These tools offer similar information, but present it in different ways. <a href=\"https:\/\/app.sistrix.com\/en\/hreflang-validator\" target=\"_blank\" rel=\"noreferrer noopener\">Sitrix&#8217;s hreflang tag testing tool<\/a> displays the tags on your website, and lets you know if there are any errors:<\/p>\n\n\n\n<p><a href=\"https:\/\/technicalseo.com\/tools\/hreflang\/\" target=\"_blank\" rel=\"noreferrer noopener\">Merke&#8217;s hreflang tags testing tool<\/a> also provides a breakdown of the tags and errors on your website:<\/p>\n\n\n\n<p>If you only want to see errors, however, <a href=\"https:\/\/hreflangchecker.com\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">SALT.agency&#8217;s hreflang tag testing tool<\/a> is another option.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Keep learning with WP Engine<\/h2>\n\n\n\n<p>If you have a website with content <a href=\"https:\/\/wpengine.com\/solution-center\/multilingualpress\/\" target=\"_blank\" rel=\"noreferrer noopener\">in multiple languages<\/a>, hreflang tags will help Google deliver the right pages to the right visitors. Fortunately, there are several ways to add hreflang tags to your website, with the easiest option being to install a dedicated plugin.&nbsp;<\/p>\n\n\n\n<p>If you are struggling with any other aspect of running <a href=\"https:\/\/wpengine.com\/solution-center\/polylang\/\" target=\"_blank\" rel=\"noreferrer noopener\">your multilingual website<\/a>, WP Engine is dedicated to helping you find the resources you need. Learn more about our industry-leading <a href=\"https:\/\/wpengine.com\/wordpress-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">hosting for WordPress sites<\/a> and check out <a href=\"https:\/\/wpengine.com\/plans\/\" target=\"_blank\" rel=\"noreferrer noopener\">our plans<\/a> today!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you building a website that supports multiple languages and regions? A multilingual site can expand your potential audience exponentially, but can also seem difficult to manage. The good news is that adding hreflang tags can improve your site\u2019s Search Engine Optimization (SEO) and User Experience (UX). It\u2019s not that hard to accomplish, and you<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":177,"featured_media":0,"template":"","resource-topic":[904,912,910],"resource-role":[895,896,897,903,1296,899],"resource-type":[916],"class_list":["post-103001","resource","type-resource","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Mastering hreflang in WordPress: Essential SEO Guide | WP Engine\u00ae<\/title>\n<meta name=\"description\" content=\"Hreflang WordPress tags are one of the most complicated aspects of multilingual websites. Learn how to implement hreflang tags on your Wordpress site!\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mastering hreflang in WordPress: Essential SEO Guide | WP Engine\u00ae\" \/>\n<meta property=\"og:description\" content=\"Hreflang WordPress tags are one of the most complicated aspects of multilingual websites. Learn how to implement hreflang tags on your Wordpress site!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-29T16:19:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/05\/welcome-languages-1-1024x682-2.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/hreflang-tags-for-wordpress\/\",\"url\":\"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/\",\"name\":\"Mastering hreflang in WordPress: Essential SEO Guide | WP Engine\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2020-05-04T14:39:55+00:00\",\"dateModified\":\"2024-09-29T16:19:16+00:00\",\"description\":\"Hreflang WordPress tags are one of the most complicated aspects of multilingual websites. Learn how to implement hreflang tags on your Wordpress site!\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Add hreflang Tags in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/aba73ed4c15eda43b5fd78844ec31fad\",\"name\":\"Samantha Rodriguez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g\",\"caption\":\"Samantha Rodriguez\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mastering hreflang in WordPress: Essential SEO Guide | WP Engine\u00ae","description":"Hreflang WordPress tags are one of the most complicated aspects of multilingual websites. Learn how to implement hreflang tags on your Wordpress site!","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"Mastering hreflang in WordPress: Essential SEO Guide | WP Engine\u00ae","og_description":"Hreflang WordPress tags are one of the most complicated aspects of multilingual websites. Learn how to implement hreflang tags on your Wordpress site!","og_url":"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2024-09-29T16:19:16+00:00","og_image":[{"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/05\/welcome-languages-1-1024x682-2.png"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/hreflang-tags-for-wordpress\/","url":"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/","name":"Mastering hreflang in WordPress: Essential SEO Guide | WP Engine\u00ae","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2020-05-04T14:39:55+00:00","dateModified":"2024-09-29T16:19:16+00:00","description":"Hreflang WordPress tags are one of the most complicated aspects of multilingual websites. Learn how to implement hreflang tags on your Wordpress site!","breadcrumb":{"@id":"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/resources\/hreflang-tags-for-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"How to Add hreflang Tags in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/aba73ed4c15eda43b5fd78844ec31fad","name":"Samantha Rodriguez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g","caption":"Samantha Rodriguez"}}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/04\/shutterstock_179815778.jpg","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Agency, Developer, Freelancer, Marketer, Publisher, Site Owner","topic":"<strong>Topics:<\/strong> Marketing, Performance, SEO","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/103001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/177"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=103001"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=103001"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=103001"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=103001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}