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.
Tagged: Exception
This topic contains 26 replies, has 0 voices.
Last updated by Carlos Rojas 1 month, 2 weeks ago.
Assisted by: Carlos Rojas.
Author | Posts |
---|---|
May 4, 2025 at 4:51 am #16992680 | |
marikaK |
Background of the issue: Symptoms: Questions: |
May 6, 2025 at 12:46 pm #17001669 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Hello, Please follow these steps to obtain more information regarding the cause of the error: Looking forward to your message. |
May 6, 2025 at 4:50 pm #17002920 | |
marikaK |
Hello, Carlos! Hope I did as requested.. P.s. I see that there is written something about elementor.. Just want to mention I have newest versions of WPML and Elementor and everything else is up to date as well.. |
May 7, 2025 at 6:25 am #17004368 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Hi, However, I'll need you to share the complete fatal error message so I can understand what is happening. |
May 7, 2025 at 6:40 am #17004415 | |
marikaK |
I can't upload full error log document, so see attached screenshot. |
May 7, 2025 at 6:54 am #17004534 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Please copy the fatal error from line 1122724 to line 1122766 and paste it in your next message. |
May 7, 2025 at 7:05 am #17004627 | |
marikaK |
null given, called in /home4/vintekol/orberg.lv/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/QueryFilter.php on line 34 and defined in /home4/vintekol/orberg.lv/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php:13 |
May 7, 2025 at 7:22 am #17004701 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Sorry, I made a mistake. The starting line is 1122723, the previous one that contains 'Fatal Error'. Could you paste the full error message again? |
May 7, 2025 at 7:23 am #17004702 | |
marikaK |
Yes, of course 🙂 [06-May-2025 16:39:48 UTC] PHP Fatal error: Uncaught TypeError: WPML\PB\Elementor\DataConvert::serialize(): Argument #1 ($data) must be of type array, |
May 7, 2025 at 7:43 am #17004746 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Thank you very much! The most likely cause of this issue is that the _elementor_data field is null or contains invalid data. I kindly ask you to follow these steps and let me know the results: Could you tell me if the issue disappeared? |
May 7, 2025 at 7:57 am #17004825 | |
marikaK |
I updated content. Saved the changes. Cleared cache as well. Still the same problem. :/ And there is NO translation for products - so I can't update translation for product content. Website is just in one language. WPML is used just for string translation to Latvian (like Woocomerce Description -> Apraksts, Addidional information-> Tehniskie dati, HOME-> Sākums etc.) And as I told before - if deactivate WPML String Translation plugin the problem is gone and everything works perfectly, but in this case all the strings are not translated - and it is not acceptable. This is the reason why I need WPML - to localize all page in Latvian. |
May 7, 2025 at 8:10 am #17004877 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Thank you for your message. Although the problem disappears when the String Translation plugin is deactivated, the cause of the issue is not the String Translation plugin. Can you share the access credentials to the site in your next message so I can take a closer look? I have set your next message private so you can share the credentials securely. Confirm you have a full site backup that you can restore if necessary. |
May 7, 2025 at 11:19 am #17005927 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Thank you very much for sharing the credentials requested. Before we continue, I kindly ask you to run the Woocommerce Multilingual wizard: hidden link and double-check if the issue has disappeared. |
May 7, 2025 at 11:31 am #17006175 | |
marikaK |
Done! And cleared cache as well. Still the same - issue hasn't disappeared.. :/ |
May 7, 2025 at 11:49 am #17006262 | |
Carlos Rojas WPML Supporter since 03/2017
Languages: English (English ) Spanish (Español ) Timezone: Europe/Madrid (GMT+02:00) |
Thank you! I ran several troubleshooting steps, but the issue persists. Can you create a staging site with a copy of the live site where we can run further tests without affecting the live site? You next message will be private so you can share the access credentials to the staging site securely. |