Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The website is in german and needs to be translated in english (sub-folders).

Is there any documentation that you are following?

I was following the wizard from WPML..

What is the link to your site?

https://ocean-re-creation.de/

After clicking on "finish" I have a critical error on the screen.
In the log:

2022/05/12 14:07:28 [error] 3669737#3669737: *6206 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:495 the database contains post_attachment while this function was called with post_nav_menu_item in

Solution:
https://wpml.org/forums/topic/error-with-translate-everything/#post-11218167

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

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

Last updated by Matthias 1 year, 11 months ago.

Assisted by: Mateus Getulio.

Author Posts
May 12, 2022 at 2:15 pm #11209823

Matthias

Hi,

Tell us what you are trying to do?

The website is in german and needs to be translated in english (sub-folders).

Is there any documentation that you are following?

I was following the wizard from WPML..

What is the link to your site?

hidden link

After clicking on "finish" I have a critical error on the screen.
In the log:

2022/05/12 14:07:28 [error] 3669737#3669737: *6206 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:495 the database contains post_attachment while this function was called with post_nav_menu_item in /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34
Stack trace:
#0 /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(1515): WPML_Set_Language->set()
#1 /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(214): SitePress->set_element_language_details()
#2 /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(82): WPML_Nav_Menu->_set_menus_language()
#3 /var/www/clients/client251/web1417/web/wp-includes/class-wp-hook.php(307): WPML_Nav_Menu->init()
#4 /var/www/clients/client251/web1417/web/wp-includ" while reading response header from upstream, client: 37.24.244.89, server: ocean.test-umgebung.de, request: "GET /wp-admin/admin.php?page=tm/menu/main.php HTTP/2.0", upstream: "hidden link:", host: "ocean.test-umgebung.de", referrer: "hidden link"
2022/05/12 14:07:31 [error] 3669737#3669737: *6206 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match for element_id:495 the database contains post_attachment while this function was called with post_nav_menu_item in /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-set-language.php:34
Stack trace:
#0 /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php(1515): WPML_Set_Language->set()
#1 /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(214): SitePress->set_element_language_details()
#2 /var/www/clients/client251/web1417/web/wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/class-wpml-nav-menu.php(82): WPML_Nav_Menu->_set_menus_language()
#3 /var/www/clients/client251/web1417/web/wp-includes/class-wp-hook.php(307): WPML_Nav_Menu->init()
#4 /var/www/clients/client251/web1417/web/wp-includ" while reading response header from upstream, client: 37.24.244.89, server: ocean.test-umgebung.de, request: "GET /wp-admin/admin.php?page=tm/menu/main.php HTTP/2.0", upstream: "hidden link:", host: "ocean.test-umgebung.de", referrer: "hidden link"

Backend is broken, so I cannot paste the debug information.

The website is using Avada (current version). WordPress ist current verison and WPML was installed using the new installer

Best regards - M.

May 12, 2022 at 3:13 pm #11210309

Matthias

The error is not only with translate everything.. what ever I try, when I finish the wizard, there is a crititcal error display and the backend is no more available.
In the logs it is the same error.

May 13, 2022 at 7:44 am #11213983

Matthias

I have made many other tries in between, all with the same error as result:

- translate everything / translate some
- language as sub folder, language as sub domain
- install a version from january 2022 (4.5.3)
- activate a standard theme before starting wizard (twentytwo)

(And yes, I know abouot this page: https://wpml.org/documentation/theme-compatibility/using-wpml-with-the-avada-theme/ - but I it does not really help, actually it states that WPML can be used as usual)

Sorry, the url is: hidden link

May 13, 2022 at 8:58 am #11214731

Matthias

I even tried with a 4.4.1. version (before translate everything was available) - same error

Also, tested with PHP 7.4 and PHP 8.0.

May 13, 2022 at 2:39 pm #11218167

Mateus Getulio
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Welcome to the WPML support forum!

This kind of error generally happens because of corrupt entry or misconfiguration in the database. Please check the errata page related to this issue: https://wpml.org/errata/fatal-error-invalidargumentexception-element_id-and-type-do-not-match/

Let's try some possible solutions to see if this gets corrected:

**IMPORTANT** - Please make a backup of the site files and database before doing the following procedures:

#1 If you can still access your WP Dashboard:

- Go to WPML -> Support
- Click on the Troubleshooting link
- Click on the Fix post type assignment for translations button

#2 If you can’t access the WP Dashboard or the steps above do not help:

- Get access to your database using phpMyAdmin (or any other similar tool)
- Go to the wp_icl_translations table
- Find the entry with element_id:495 and delete that row

It might be necessary to replicate this workflow a couple of times until the issue is fixed.

Please give those instructions a try and let us know how they go. We're looking forward to your reply. Thanks!

Kind regards,
Mateus.

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