Regarding your changelog:
- Fixed an issue where the post slug appeared as not translated when using the "Translatable - use translation if available or fallback to default language" translation setting.
Your code for this change:
if ( $this->sitepress->is_display_as_translated_post_type( $post->post_type ) ) {
$ld->language_code = apply_filters( 'wpml_current_language', null );
}
We have translated the woocommerce shop page slug in WCML > Store URLs like:
German (default language): webshop
French: shop
We are using Yoast sitemap, which lists all posts and their translations in the same sitemap.
With 3.5.0, the French products use the correct SHOP slug: hidden link
With 3.5.1, the product sitemap uses the German slug WEBSHOP (because the current language while showing the sitemap is German (default)) hidden link
Thanks for reaching out, and sorry for the delay. I am going to consult with our developers and get back to you with the information that they provide.
Our developers were able to reproduce your issue and are already working towards a solution.
For reference, the issue was originated in the fix introduced to solve this problem: https://wpml.org/fr/forums/topic/product-base-slug/:
- A post type set as "Translatable - use translation if available or fallback to default language", with archives, and a translated slug for each language.
- When visiting the archives in a secondary language, posts of that type that were not translated were using a permalink with the untranslated, original post type slug. Only translated posts were showing the right permalink.
Our developers will take care of the regression affecting sitemaps. While this happens, and as a temporary workaround, you might want to comment out the line in the piece of code that you shared:
Our development team has completed their analysis, and they will include a fix for this problem in our next release for WPML.
Please let me know if you need a patch based on that permanent solution or whether the workaround provided in my previous comment is enough for your current case.