Skip Navigation

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.

This topic contains 11 replies, has 8 voices.

Last updated by luisC-15 8 years, 6 months ago.

Assigned support staff: Andrea.

Author Posts
July 15, 2013 at 5:54 am #144633



I am using the latest versions of WPML and Yoast WordPress SEO plugins. I am trying to create a separate XML sitemap for each language that we have on the website. We are currently using the -- hidden link -- option.

You can see the site at -- hidden link

Language options are at --

hidden link
hidden link
hidden link
hidden link
hidden link

The sitemap that got created is at -- hidden link

The page sitemap lists all the pages in the same sitemap irrespective of the language folder demarcation. I want to create separate XML sitemaps for each of the languages being used and need to know how can I do that.

Kindly let me know.



July 15, 2013 at 6:58 am #144640


Dear Sam,

When you use WPML 2.4.2 together with WordPress SEO (version 1.1.1 and above), you’ll get individual sitemaps – one per language.

Please see details here:
Scroll down to "SEO Love with Per-Language Sitemaps".

I hope this helps.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have

July 15, 2013 at 7:18 am #144652


Hello Andrea,

Thanks a lot for your reply. I see that in the link you have mentioned, there is no step required to be taken on my side to get the individual sitemaps, is that right? Does it happen automatically? Or do I have to do something to get the favorable output?

The reason I ask is because, I have already set-up the WordPress SEO plugin and the sitemap generated at -- hidden link -- is not ideally how it should be like with the language demarcation.

Can you please guide me on what I might be missing out on?



July 15, 2013 at 11:21 am #144751


Dear Saumil,

The article I've linked focuses on "languages-per-domains", that is not your case.

On solution is provided here:

It's in Spanish, but in short, just add this code to your functions.php:

if (isset($sitepress)) add_filter('wpseo_posts_join', 'sitemap_per_language', 10, 2);
function sitemap_per_language($join, $type) {
    global $wpdb, $sitepress;
    $lang = $sitepress->get_current_language();
    return " JOIN " . $wpdb->prefix . "icl_translations ON element_id = ID AND element_type = 'post_$type' AND language_code = '$lang'";

Then, on Google Webmaster Tools, add your sitemaps, one per language. For instance:

hidden link (default)
hidden link
hidden link
hidden link

Please note that you must use more than one file for each language:
- category-sitemap.xml
- post-sitemap.xml
- page-sitemap.xml

Which name to use, depends on how your sitemap is built, but you can get an idea looking at your sitemap_index.xml (that, as far as I can see, it only contains "page-sitemap.xml").

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

July 16, 2013 at 11:38 am #145326


Thanks a lot, Andrea!

The solution worked perfectly.

Thanks a lot for all the help.



January 30, 2014 at 10:50 am #330404


This solution is not working for global XML sitemap as hidden link

May 23, 2014 at 8:55 am #405846


Hi Andrea,

I am working on a website in different languages and I am using the last versions of WPML plugins and YOAST SEO.

I tried the solution you post above, inserting that code in the functions.php of my theme, and now I have a sitemap_index for each language:

hidden link
hidden link
hidden link
hidden link

The problem is that these sitemap_index are the same in all languages, their links point only to the original language (english).

However, the other sitemaps are created right, for example:

hidden link
hidden link

Is this the expected behaviour?

Might this be a problem for a correct Google indexation?

Should I avoid to send to webmaster tools the sitemap_index on the other languages different from english?
For example, should I just send for the spanish language hidden link these three sitemaps:

hidden link
hidden link
hidden link

But not the sitemap_index: hidden link

Thanks in advance,

May 23, 2014 at 7:53 pm #406273


Just in case, I will start a new thread.


September 17, 2014 at 10:16 am #473291


is this still how it works,
still no proper solution for languages in maps like:

October 20, 2014 at 7:07 am #495019


I have added the code snippet also and sitemaps still dont work even in:


Any ideas?

September 15, 2015 at 12:08 pm #704513


I use version and i have problems for the xml files. The are the same. No link to /en/


I hope someone can help me?
I already use the extra php code in functions.php in my theme (cherry).

February 6, 2017 at 9:49 pm #1201020



I just found this thread and currently have a website that is in both English and Spanish but don't see automatic separation of languages within the website.

hidden link