[4.10.1] Possible bug when filtering attribute names
-
Hi,
I think there’s a bug in
class-wcml-attributes.php
. If you check the methodfilter_attribute_name
here, the current language is switched based on$sanitize_in_origin
here and switched back to the original language here.In order for the language to be changed, only
$sanitize_in_origin
needs to betrue
, but for it to be changed back to the original language,$return_sanitized
has to betrue
as well. This isn’t always the case and in my case this causes mixed translation content on the page since it doesn’t “clean up” the language switch properly.My case is fixed by changing the return part (starting here) to this:
... if ( $return_sanitized ) { $attribute_name = sanitize_title( $attribute_name ); } if ( $sanitize_in_origin ) { $this->sitepress->switch_lang( $current_language ); } return $attribute_name;
This reverts the language switch based on the same criteria it’s initially switched.
Would be great if you could check if this is valid, and if yes include it in a future release.
Thanks!
WooCommerce: 4.3.1
WooCommerce Multilingual: 4.10.1
WPML Multilingual CMS: 4.3.18
WPML String Translation: 3.0.13
- The topic ‘[4.10.1] Possible bug when filtering attribute names’ is closed to new replies.