Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 4.4.10

Resolved in: WPML 4.6.7

Overview of the issue

A blank screen appears and after enabling debug mode, the following error appears in some configurations:

PHP Fatal error: Uncaught InvalidArgumentException: element_id and type do not match in \wp-content\plugins\sitepress-multilingual-cms\classes\core-abstract-classes\class-wpml-set-language.php on line xx

These kinds of exceptions were hidden from the user in the previous version. In the long run, however, they might lead to database corruption and we have decided to no longer hide them. Starting from WPML 3.3.5, such exceptions are thrown to allow users to spot the issue immediately. This will make fixing issues with corrupted settings much easier, since they can be caught in their early stage.

Issues may look different on different installations. The issue may:

  • Appear in WPML admin pages.
  • Make it impossible to access the Plugins page.
  • Occur on WPML (or its add-ons) activation only.
  • Occur when posts are being saved.

A blank screen appears in every case, with the error appearing with debug mode enabled.

Workaround

Please, make a full backup of your site before proceeding.

If you can still access to your Dashboard:

  1. Go to WPMLSupport.
  2. Click on the Troubleshooting link.
  3. Click on the Fix post type assignment for translations button.
  4. You may need to click on the Remove ghost entries from the translation tables button.

If you can’t access or it does not help:

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

You might need to repeat the workflow several times until the issue is fixed.

20 Responses to “Fatal error: InvalidArgumentException: element_id and type do not match”

    • Hello Gustavo,

      This issue was fixed in WPML 3.3.6 and everything should work in the 3.3.7 beta version as well. Could you please report the issue using the support forum? There, we will be able to provide faster and better support, adjusted to your specific case – something we can’t do via these comments.

  1. Hello i’m using WPML Multilingual CMS 4.5.1 in a fresh new installation and i’m experiencing a lot of wpml-cms issues.

    I almost ever experienced from this october this kind of issues until it was broken in unknow way ( gave error 500 on every i18n’s page load). It was impossible to migrate it safely and was very strugglying to debug.
    I guess wpml auto upgraded itself but then trying to solve i updated, reinstalled, upgraded but nothing worked.

    At the end i reinstalled in a separate fresh env to and i’m experiencing this kind of issue without even having ever used it.

    Is this a stable product or to use it is only a big waste of time?

    • Hello there,

      I’m sorry for your experience. However, WPML does not upgrade automatically, it needs to be approved by an user with those rights.
      Regarding this error, if after applying the fix proposed in this article the issue remains, please open a ticket in our support forum so we can help you better as we don’t have the right debugging tools here.

      Regards

  2. Yes thank you.

    1) increase the WordPress Memory Limit
    2) Fix post type assignment for translations under the Support Page | i had 290 issue fixed.

    Originally, i want to rebuild the site. Now is OK.

    Thanks a Lot

  3. hello
    i cant understand what to do and how to do it.
    i have problem with my both websites,
    can you help me please ?

    thanks

    • Hello @tawfiqM,

      If you are having issues applying any of those workarounds, please open a ticket in our support forum where one of our specialists will guide you through this process.
      Regards

  4. unfortunately, the error still exists, now the latest article is not visible, even though a backup was made and the suggested fatal error code was also deleted

  5. Hello!

    We were installing WPML in a new site and we were getting this PHP fatal error after running the configuration wizard.

    We tried different solutions, including the workaround from this page and it didn’t work:

    You might need to repeat the workflow several times until the issue is fixed.

    We tried the workaround and after 10 iterations we checked and the table had 29K rows… So there was a possibility that this would be a never ending task, and we started looking for another alternative.

    Finally, this worked for my team and may work for the rest of the WPML community:

    1) Install the WPML plugin.
    2) When you are on the first screen of the configuration wizard, open the Support page in a new window (WPML → Support), and then click on troubleshooting.
    3) Scroll to the bottom, check the “I am about to reset all translations and language data” and click on the Reset and deactivate WPML button.
    4) This will take you to the Plugins page with a message saying that the plugin was deactivated. Activate it again.
    5) Then you will be able to complete the configuration wizard and everything will work after that. No more PHP fatal error.

    (Solution tested with WordPress 6.2.2 + WPML 4.6.5 + PHP 8.0)

    • I’m glad to know that your solution worked for you. We apologise if that was needed, it shouldn’t have been necessary, but it seems you had an issue during the WPML installation.
      Thank you very much for sharing Kristin!