Skip Navigation

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 25 replies, has 2 voices.

Last updated by Andreas W. 1 year, 8 months ago.

Assisted by: Andreas W..

Author Posts
June 30, 2022 at 5:30 pm #11579591

laurisP

Found an issue with WPML (use last version of WPML CMS).

Here is how it happens:

1. Activate WPML
2. Go to the Widget Page
3. Nothing could be clicked - if you try - you get Critical Error
4. I tried to delete all inactive widgets and when i get Language switcher widget following error appeared:

Fatal error: Uncaught Error: Call to a member function slug() on array in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-widget.php:84 Stack trace: #0 /home/bio2you/public_html/stg/wp-includes/class-wp-widget.php(534): WPML_LS_Widget->form(Array) #1 /home/bio2you/public_html/stg/wp-admin/widgets-form.php(290): WP_Widget->form_callback(Array) #2 /home/bio2you/public_html/stg/wp-admin/widgets.php(34): require('/home/bio2you/p...') #3 {main} thrown in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-widget.php on line 84

Here is what i get on my email:

Error Details
=============
An error of type E_ERROR was caused in line 34 of the file /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php. Error message: Uncaught InvalidArgumentException: element_id and type do not match for element_id:11675 the database contains post_shop_order while this function was called with post_attachment in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34
Stack trace:
#0 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(1522): WPML_Set_Language->set('11675', 'post_attachment', NULL, 'lv', NULL, true)
#1 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(2155): SitePress->set_element_language_details('11675', 'post_attachment', NULL, 'lv')
#2 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(2125): TranslationManagement->add_missing_language_to_post(Object(stdClass))
#3 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multili

July 1, 2022 at 2:26 am #11581901

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better for a testing site where the issue is replicated.

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “All In One WP Migration” on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT

Please make a backup of site files and database before providing us access.
If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

The steps are also shown in this video: hidden link

Best regards
Andreas

July 1, 2022 at 12:57 pm #11585207

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Please take a backup of your site and database and update the Parent Theme to the latest version and let me know if the issue persists.

Best regards
Andreas

July 1, 2022 at 2:42 pm #11585703

laurisP

Unfortunately, the problem persists. Nothing is changed. Please, see screenshot link: hidden link

July 1, 2022 at 11:54 pm #11587617

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I am taking a copy of the site for further investigation on a virtual server and will get back to you shortly.

Best regards
Andreas

July 2, 2022 at 6:59 am #11589409

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I can confirm the same issue when testing the Shoptimizer Parent theme only with WPML Multilingual CMS on a copy of your site.

The error found on the page refers to the WPML language switcher widget.

I need you to please install the Shoptimizer Theme in its latest available version on the following sandbox as I need to confirm if we can replicate the issue on this new WordPress install, and then escalate the problem internally to our team.

One-Click-Login:
hidden link

Please leave me a short notification once the theme has been installed.

Best regards
Andreas

July 4, 2022 at 7:37 am #11595107

laurisP

I just did what you asked. So the problem with Shoptimizer? Because in this way I also will ask for help from Shoptimizer Devs. I also installed neccesarry plugins this theme asks. I strongly beleive that problem is with one of this plugins from Shoptimizer

July 4, 2022 at 6:20 pm #11600283

laurisP

I guess it is not about just with Shoptimizer. Just tried to activate Storefront theme and then WPML CMS and here what i get:

Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:11676 the database contains post_shop_order while this function was called with post_attachment in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34 Stack trace: #0 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(1522): WPML_Set_Language->set('11676', 'post_attachment', NULL, 'lv', NULL, true) #1 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(2155): SitePress->set_element_language_details('11676', 'post_attachment', NULL, 'lv') #2 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(2125): TranslationManagement->add_missing_language_to_post(Object(stdClass)) #3 /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multili in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php on line 34
There has been a critical error on this website. Please check your site admin email inbox for instructions.

July 6, 2022 at 2:44 am #11609331

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

In fact, I am not able to replicate the issue on the Sandbox, while using WPML and various addons including CMS Nav and Sticky Links.

I also tested here the theme settings to change from Classic Widget Editor to the new Block Editor and back, but could not replicate the issue.

Test-Site:
hidden link

Further, the issue can not be related to another plugin, if not any other plugin is activated on the site.

The error that you mention in your last message points toward an issue inside your database and in order to fix this issue you need to delete the DB entry that includes the:

element_id:11676

from the table:

icl_translations

I tried this on your staging, by using the Adminder Plugins, but it seems I am not able to run any tasks on the database directly.

Now, the error on the Appearance > Widgets screen is a different one:

Fatal error: Uncaught Error: Call to a member function slug() on array in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-widget.php:84 Stack trace: #0 /home/bio2you/public_html/stg/wp-includes/class-wp-widget.php(534): WPML_LS_Widget->form(Array) #1 /home/bio2you/public_html/stg/wp-includes/widgets.php(2049): WP_Widget->form_callback(Array) #2 /home/bio2you/public_html/stg/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php(701): wp_render_widget_control('icl_lang_sel_wi...') #3 /home/bio2you/public_html/stg/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php(154): WP_REST_Widgets_Controller->prepare_item_for_response(Array, Object(WP_REST_Request)) #4 /home/bio2you/public_html/stg/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Widgets_Controller->get_items(Object(WP_REST_Request)) #5 /home/bio2you/public_html/stg/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request(Object(WP in /home/bio2you/public_html/stg/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-widget.php on line 84

This issue could be related to the fact that according to the information I see on the page WPML > Support the REST API appears to be disabled on the site.

https://wpml.org/documentation/support/rest-api-dependencies/?utm_source=plugin&utm_medium=gui&utm_campaign=wpmlcore

In order to confirm this issue, I will continue testing the copy of your site on a virtual server.

I will be in contact after I finished testing.

Best regards
Andreas

July 6, 2022 at 10:58 am #11613105

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I tried taking a new copy of your site for testing it on Localhost but once the migration was completed I only find a broken theme and nothing else that have been generated, not even the database.

I will try again tomorrow, but if you could set up a staging site or clone of your website in the meantime on which I can debug the issue, then this would be highly appreciated and save us a lot of time.

Please let me know in case you managed to setup such environment.

Best regards
Andreas

July 8, 2022 at 8:20 am #11628761

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I just spoke to somebody from our second-tier support and he suggested:

- Deactivate all language switchers
- Go inside the database to the wp_options table and delete the option_value of the option_Name "wpml_language_switcher_template_objects".

Now, on your staging, I can see the DB, but I am not allowed to edit (Invalid CSRF token), which for I can not proceed to debug.

Setting up a local test environment with a copy of your site also fails.

We need unrestricted DB and server access in order to assist you on this matter.

Best regards
Andreas

July 11, 2022 at 11:09 am #11641725

laurisP

Can you please instruct me how to do it? Or maybe provide me with support article link?

July 12, 2022 at 3:53 pm #11652273

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

You should go to WPML > Languages and disable/remove any activated language switchers.

Then, you need to connect to the database, for example by using PHPmyAdmin from your hosting panel.

You will need to locate the data table "wp_options" which might have a different prefix on your DB, depending on your WordPress setup.

There search for the option_name "wpml_language_switcher_template_objects".

Click to edit the option inside the row settings and delete the option_value field, then save the entry.

Guide:
hidden link

If you are not aware of how to use this database tool, then I would suggest you provide me access to your hosting account and I will have a look into it.

The private reply form is enabled again.

Best regards
Andreas

July 13, 2022 at 9:45 am #11657545

laurisP

Hello Andreas,

1) I remove any langs except default which is Latvian - am I understand you right?
2) Delete value field you described.

What next?

July 13, 2022 at 8:55 pm #11662279

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

At WPML > Languages you find various options for language switchers:

- Menu languages switcher
- Widget language switcher
- Footer language switcher
- Custom language switcher

Make sure that not any of those options is enabled.

Then proceed with the database task.

You need to delete the entries inside the option_value column of the row with the option_name "wpml_language_switcher_template_objects" and save.

If you need any assistance with this workaround please let me know, and I will be glad to assist you on this matter but take note, that I was not able to edit your database from admin access by using a plugin.

I would need access to your database by CPanel/PhpMyAdmin.

Best regards
Andreas

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.