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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

This topic contains 7 replies, has 2 voices.

Last updated by Dražen Duvnjak 2 years ago.

Assisted by: Dražen Duvnjak.

Author Posts
March 21, 2022 at 5:33 pm #10840731

Giulio

Hello,

I use Yoast for the Sitemap creating and WPML to translate the web site. I'd like to ask you who can be responsible for the listing of a wrong URL inside the sitemap in your opinion.

For example in my case /negozio is the URL for the Italian main page of my shop online and /en/shop is the correct one for English. Both URL works.

But the sitemap made by Yoast lists /en/negozio sometimes. The funny thing is that every time in the meanwhile the products page are listed correctly (for example /en/shop/product)

So now who is responsible for this issue? WPML or Yoast? Is it maybe a known issue?

Thanks a lot.

March 24, 2022 at 10:06 am #10865485

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello!

Welcome to WPML Support. I'll do my best to help you solve this issue.

To be fair with you, it is hard to tell without further debugging or if the issue happens randomly.

I suggest creating a staging site and trying to see if any specific steps or actions cause the slug to be changed. Then check if the issue happens when using WP default theme and only WPML and Yoast plugins, that way we know for sure it is not caused by 3rd party plugin/code.

Otherwise, if the issue still happens in this minimal environment, it is up to us and Yoast together, since we are officially compatible. We will then check and debug your issue further in the search for a solution.

Please check, and try to see if you can get more info on the issue following my suggestion.

Kind regards,
Drazen

March 24, 2022 at 1:49 pm #10868231

Giulio

Dear Drazen,

thanks for answering me.

I'm in touch with Yoast right now, as you can also see here: https://wordpress.org/support/topic/yoast-sitemap-error-synchronizing-slug-with-wpml/

They still didn't suggest me to create a staging web site... but to start maybe from your side you could take a look to our sitemap. In Yoast case I preferred do not paste our web site URL on a public forum, but in this case I think that you could take a look.

Did you already check if someone had the same problem with WPML? I tried on your forum, but I didn't find anything.

Thanks.

March 24, 2022 at 2:25 pm #10868545

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello Giulio,

thanks for getting back and providing more info.

I have checked the Yoast support forum and your website sitemap, it was helpful to understand the issue. The conclusion is it only happens with shop slug and in Yoast Sitemap, translations and frontend show up fine.

I have managed to find a similar if not the same report by another user, and it is already in our developer's queue for a fix in the future versions.

Please try the following workaround:

- Go to wp-content/plugins/wp-seo-multilingual/classes/class-wpml-wpseo-xml-sitemaps-filter.php

Add the following code just above line 151 (the default case):

case 'product':
					if ( class_exists( 'woocommerce') ) {
						$this->sitepress->switch_lang( $lang_code );
						$current_lang_shop_id = apply_filters('wpml_object_id', wc_get_page_id( 'shop' ), 'page', true, $lang_code);
						$url = get_permalink( $current_lang_shop_id );
						$lastmod = get_the_modified_time( 'c', $current_lang_shop_id );
						$this->sitepress->switch_lang();
						break;
					}

NOTE: Always have a recent and working backup before making any changes recommended by our team or a 3rd party

Let me know how it goes.

Kind regards,
Drazen

March 24, 2022 at 2:30 pm #10868697

Giulio

Thanks a lot for your suggestion. It seems easy! I'll forward it to our developer to try introduce it in our web site and take a look to the result.

I'll update this thread within 7 days.

March 25, 2022 at 6:53 am #10873731

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

sure, let us know how it goes.

Kind regards,
Drazen

March 30, 2022 at 10:17 am #10910029

Giulio

It works! Great! Thanks a lot. Is there a way to know when you will add it on your plugin directly?

March 30, 2022 at 11:03 am #10910469

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

great, thanks for confirming.

I can not share any ETA, since it is still under development. But I will keep this ticket open with the status "Escalated to Compatibility team" and update you when the version with the fix is released. 🙂

Kind regards,
Drazen