This thread is resolved. Here is a description of the problem and solution.
Problem: The client was trying to translate a page using WPML with Elementor and encountered several warnings related to undefined array keys and invalid arguments for foreach loops in the files class-wpml-elementor-translate-ids.php and DynamicElements.php. Solution: We recommend updating to the latest version of the Consulting theme, which includes a fix for these issues. If you're experiencing this problem, please ensure you have the latest theme version installed.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please do not hesitate to open a new support ticket at WPML support forum.
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.
Background of the issue:
I was trying to translate my second page using WPML and encountered several warnings related to Elementor. The warnings occurred in the file located at /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php. I was attempting to translate the page when the issue occurred. Here are some warnings that can be seen on my page:
Warning: Undefined array key "elements" in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php on line 120
Warning: foreach() argument must be of type array|object, null given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php on line 112
Warning: foreach() argument must be of type array|object, null given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/class-wpml-elementor-translate-ids.php on line 133
Warning: foreach() argument must be of type array|object, null given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DynamicElements.php on line 71
Warning: foreach() argument must be of type array|object, null given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DynamicElements.php on line 71type array|object, null given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DynamicElements.php on line 71
Warning: foreach() argument must be of type array|object, null given in /var/www/html/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elem
Warning: foreach() argument must be of entor/Hooks/DynamicElements.php on line 71
Symptoms:
I received multiple warnings such as 'Warning: Undefined array key "elements"' and 'Warning: foreach() argument must be of type array|object, null given' in various lines of the class-wpml-elementor-translate-ids.php file and DynamicElements.php file.
The problem is with the Consulting Elementor Widgets plugin.
When it is deactivated, the warnings do not show.
Can you please confirm this?
Also, can you please tell me what this plugin's purpose is?
Thanks for your investigation Itamar.
The plugin is needed. This is a core plugin of the Consulting Theme. It enables CTA Buttons and other widget that are part of the wordpress theme / template.
Our compatibility team further escalated this issue to our developers.
I've read our internal documentation about this case, and we will need to contact the Consulting Elementor Widgets plugin to correct things on their side. In any case, I'll keep you updated on any news here.
The developers of the Consulting Elementor Widgets plugin wrote to us to say they would look into this problem. Meanwhile, we published an errata page about it.