This thread is resolved. Here is a description of the problem and solution.
Problem:
After updating WPML and other plugins, a critical error occurs on some WooCommerce product pages when the WPML String Translation plugin is active. Deactivating the plugin resolves the issue temporarily.
Solution:
To permanently fix the issue, modify the code in two files:
1. Navigate to
/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php
and replace the unserializeString function with the following code:
private static function unserializeString( $string, $associative ) {<br /> // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize<br /> $value = is_serialized( $string ) ? unserialize( $string ) : json_decode( $string, $associative );<br /> if ($value === null){<br /> return $string;<br /> }<br /> return $value;<br />}
2. Go to
/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php
and replace the translateQueryIds function with:
public function translateQueryIds( $value, $object_id, $meta_key, $single ) {<br /> if ( WPML_Elementor_Data_Settings::META_KEY_DATA === $meta_key && $single ) {<br /> $value = get_post_meta( $object_id, WPML_Elementor_Data_Settings::META_KEY_DATA, true );<br /> if ( $value ) {<br /> $value = DataConvert::unserialize( $value, false );<br /> $value = this->recursivelyTranslateQueryIds( $value );<br /> if (is_array($value)) {<br /> $value = DataConvert::serialize($value, false);<br /> }<br /> }<br /> }<br /><br /> return $value;<br />}
After making these changes, save the files. This solution was successfully applied to a staging site, resolving the issue.
Please note that this solution might be outdated or not applicable to your specific case. If the problem persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, do not hesitate to open a new support ticket.
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 26 replies, has 0 voices.
Last updated by 1 month, 2 weeks ago.
Assisted by: Carlos Rojas.