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.

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Bobby 1 year, 1 month ago.

Assisted by: Bobby.

Author Posts
October 3, 2023 at 1:05 pm #14504925

olgaS-13

Tell us what you are trying to do?

I'm trying to use the Synchronize Menus functionality.

After reviewing the suggested changes and accepting them, the site has a fatal error because the database contains an invalid entry.

Using the information from
https://wpml.org/errata/fatal-error-invalidargumentexception-element_id-and-type-do-not-match/

resolves the problem, but the next time I try to synchronize the menus, the problem reappears exactly as before

Is there any documentation that you are following?

https://wpml.org/errata/fatal-error-invalidargumentexception-element_id-and-type-do-not-match/

Is there a similar example that we can see?

What is the link to your site?

hidden link

October 4, 2023 at 4:53 am #14509401

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

First make sure to have debug display activated that way when the fatal error happens you are able to see the ID number triggering the error.

Then allow this fatal error to happen and go to your database.

Access to your database.
Open the wp_icl_translations table.
Search for the element_id which is throwing the error.
Delete the row.

Once done refresh the page with the fatal error and check if the ID now changed, if it did repeat the steps above until done.

when this happens with menus -- the more menu items there is the more times you will need to repeat with different ids.

Another workaround could be to re create your menu from scratch (delete and re do), however, I only would recommend this if you have a simple and small menu.

Let me know your results, please.

October 4, 2023 at 11:57 am #14512777

olgaS-13

I can repair the database as I said.

The problem is that every time I try to use the menu synchronization feature it is again corrupted.

See the following snippet from the log (WordPress debug.log)

[03-Oct-2023 12:34:15 UTC] PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:14284182 the database contains post_attachment while this function was called with post_nav_menu_item in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34
Stack trace:
#0 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/sitepress.class.php(1529): WPML_Set_Language->set('14284182', 'post_nav_menu_i...', NULL, 'de', NULL, true)
#1 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(229): SitePress->set_element_language_details('14284182', 'post_nav_menu_i...', NULL, 'de')
#2 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(85): WPML_Nav_Menu->_set_menus_language()
#3 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(310): WPML_Nav_Menu->init('')
#4 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
#5 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /www/htdocs/aufwind/inc.aufwind.co.at/wp-settings.php(632): do_action('init')
#7 /www/htdocs/aufwind/inc.aufwind.co.at/wp-config.php(101): require_once('/www/htdocs/auf...')
#8 /www/htdocs/aufwind/inc.aufwind.co.at/wp-load.php(50): require_once('/www/htdocs/auf...')
#9 /www/htdocs/aufwind/inc.aufwind.co.at/wp-admin/admin.php(34): require_once('/www/htdocs/auf...')
#10 /www/htdocs/aufwind/inc.aufwind.co.at/wp-admin/index.php(10): require_once('/www/htdocs/auf...')
#11 {main}
thrown in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php on line 34
[03-Oct-2023 12:34:15 UTC] PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:14284182 the database contains post_attachment while this function was called with post_nav_menu_item in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34
Stack trace:
#0 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/sitepress.class.php(1529): WPML_Set_Language->set('14284182', 'post_nav_menu_i...', NULL, 'de', NULL, true)
#1 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(229): SitePress->set_element_language_details('14284182', 'post_nav_menu_i...', NULL, 'de')
#2 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(85): WPML_Nav_Menu->_set_menus_language()
#3 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(310): WPML_Nav_Menu->init('')
#4 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
#5 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#6 /www/htdocs/aufwind/inc.aufwind.co.at/wp-settings.php(632): do_action('init')
#7 /www/htdocs/aufwind/inc.aufwind.co.at/wp-config.php(101): require_once('/www/htdocs/auf...')
#8 /www/htdocs/aufwind/inc.aufwind.co.at/wp-load.php(50): require_once('/www/htdocs/auf...')
#9 /www/htdocs/aufwind/inc.aufwind.co.at/wp-admin/admin.php(34): require_once('/www/htdocs/auf...')
#10 /www/htdocs/aufwind/inc.aufwind.co.at/wp-admin/edit.php(10): require_once('/www/htdocs/auf...')
#11 {main}
thrown in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php on line 34
[03-Oct-2023 12:34:23 UTC] PHP Warning: Undefined array key "desktop" in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/themes/Divi/includes/builder/module/field/Position.php on line 530
[03-Oct-2023 12:34:23 UTC] PHP Warning: Undefined array key "desktop" in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/themes/Divi/includes/builder/module/field/Position.php on line 533
[03-Oct-2023 12:34:23 UTC] PHP Warning: Undefined array key 1 in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/themes/Divi/includes/builder/module/field/Position.php on line 603
[03-Oct-2023 12:34:23 UTC] PHP Warning: Undefined array key 1 in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/themes/Divi/includes/builder/module/field/Position.php on line 605
[03-Oct-2023 12:34:23 UTC] PHP Warning: Undefined array key 1 in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/themes/Divi/includes/builder/module/field/Position.php on line 603
[03-Oct-2023 12:34:23 UTC] PHP Warning: Undefined array key 1 in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/themes/Divi/includes/builder/module/field/Position.php on line 605
[03-Oct-2023 12:38:25 UTC] PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:14284183 the database contains post_attachment while this function was called with post_nav_menu_item in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34
Stack trace:
#0 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/sitepress.class.php(1529): WPML_Set_Language->set(14284183, 'post_nav_menu_i...', NULL, 'en', NULL, true)
#1 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/taxonomy-term-translation/nav-menu-translation/wpml-nav-menu-actions.class.php(86): SitePress->set_element_language_details(14284183, 'post_nav_menu_i...', NULL, 'en')
#2 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(310): WPML_Nav_Menu_Actions->wp_update_nav_menu_item(25, 14284183, Array)
#3 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
#4 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/nav-menu.php(613): do_action('wp_update_nav_m...', 25, 14284183, Array)
#6 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/menu-item-sync.class.php(178): wp_update_nav_menu_item(25, 14284183, Array)
#7 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/menus-sync.php(209): WPML_Menu_Item_Sync->sync_added_items(Array, Array)
#8 /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(151): ICLMenusSync->do_sync(Array)
#9 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(310): WPML_Nav_Menu->sync_menus_via_ajax('')
#10 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
#11 /www/htdocs/aufwind/inc.aufwind.co.at/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#12 /www/htdocs/aufwind/inc.aufwind.co.at/wp-admin/admin-ajax.php(188): do_action('wp_ajax_icl_msy...')
#13 {main}
thrown in /www/htdocs/aufwind/inc.aufwind.co.at/wp-content/plugins/old_sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php on line 34

There you can see the fatal error with ID 14284182, then I fixed the database as described in the article (not visible in the log file), the I tried again to synchronize the menus and finally you can see the fatal error with ID 14284183.

Therefore I conclude that the synchronize menu feature creates a corrupt database entry in a reproducible manner every time I try to use it with the project.

Since the project was done by someone else and we are currently "only" adding the translation, we would prefer not to redo the menus.

BTW the menus are created with DonDivi DiviMenus (hidden link)

October 4, 2023 at 8:53 pm #14515665

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

October 7, 2023 at 4:33 am #14531881

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for the access details!

I was able to run the troubleshooting actions in WPML->Support->Troubleshooting

Remove the menu and successfully re-add it and synchronize it.

Let me know your results, please.

October 10, 2023 at 12:47 pm #14550035

olgaS-13

Hi Bobby!

Thanks for your help!

I notice that the language switcher only works on certain pages.

Also, in the synchronized menus, there are only about 4 entries, whereas on the page there are many more menu items.

Are these problems connected?

How can I synchronize the menus competely?

Or do you suggest some other method to make the language switcher work on every page?

Something else I noticed is that the pages' translation does not seem to accept the completed state. Although I told it to "Finish and Verify" the translation after inputting a translation for each text, I continue to see the "gear" icon instead of a "checkmark" icon for the english translation in the pages view.

October 10, 2023 at 8:19 pm #14553671

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Hi there,

When reviewing your pages I noticed the following:

Go to pages-> notice the "gear" icon

This means that your translation is in progress, when a translation is in progress it will not be available for visitors to see in the front end.

This is causing the language switcher to not display or work as expected between languages that are missing the translation.

Also, if a page/post is not translated the menu item won't be available

To resolve:

Click on the gear icon and fully finish the translation (make sure to get it to 100% and save)

Let me know your results, please.

Screen Shot 2023-10-10 at 1.16.09 PM.png
Screen Shot 2023-10-10 at 1.16.00 PM.png
October 11, 2023 at 8:42 am #14556799

olgaS-13

Hi,

this is what I try to do:

Click the gear icon of a page (or other resource that needs a translation).

Input the translation until everything is translated (progress bar ist at 100%).

Click the "Abschließen" (Complete) button.

I'm returned to the pages overview an see the turning arrows icon forever.

When I finally reload the pages (because nothing happened for minutes) the gear icon is there again.

Pages I tried are e. g. "Datenschutz", "Home".

For "Kontakt", "Kontakt" and "Impressum" and the remaining pages it worked, but then I also had "Datenschutz" finished (pen icon) in the past but for some reason it returned to "gear icon" for no obvious reason.

What am I doing wrong? Is there some setup problem? As you write, the process should be simple enough.

As a side question: Is there a possibility to preview a page when the translation is not yet complete?

Like sometimes a translation requires the URL (or relative link) to a page that is not yet translated, but I'd like to review the translation in the original layout anyway.

Currently I mark those texts as translated even though they really aren't and have to keep track of these open issues manually.

This doesn't seem perfect to me.

Bildschirmfoto 2023-10-11 um 09.55.02.png
Bildschirmfoto 2023-10-11 um 09.53.31.png
October 12, 2023 at 12:18 am #14562067

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-08:00)

Thank you for updating me!

To answer your side question first, when you first add a translation to a page it needs to be at 100% before you can view it as it is in progress, and does not "exist" yet. You can always go back and edit the specific areas if you need to change a URL.

Please go to WPML->support->troubleshooting->syncrhonize local job ids with ATE jobs

then re try to translate the page and let me know your results, please.

October 18, 2023 at 3:09 pm #14606277

olgaS-13

I re-saved the mentioned pages and was then able to finish the translation.