WMPL is triggering a FATAL error on our multisite install.
hidden link
To replicate go to this subsite: hidden link
We have taken the following steps to try and fix the issue:
- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Set language information
- Fix WPML tables collation
- Assign translation status to duplicated content
- Synchronize local job ids with ATE jobs
- Fix terms count
- Fix post-type assignment
- Cleanup and optimize string tables
The error received is:
===================================================
PHP message: PHP Fatal error: Uncaught InvalidArgumentException: Argument $language_code must be a non empty string. in ............s/language-switcher/class-wpml-ls-settings.php(407): WPML_LS_Settings->{closure}()\n#3 /home/public_html/wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-render.php(144)
===================================================
This is either an indication of the usage of older version of WPML or WPML addons or a corrupt database entries.
For the first one please do as follows:
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Go to "WordPress Dashboard > Plugins > Add new > Commercial (tab)".
- Click the "Check for Updates" button.
- Update WPML and its addons there.
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Go to the database of your website and perform the SQL commands below:
DELETE FROM `wp_postmeta` WHERE post_id in (select element_id from wp_icl_translations where language_code = "")
Delete from wp_posts where id in (select element_id from wp_icl_translations where language_code = "")
DELETE FROM `wp_icl_translations` WHERE `language_code` = ""
The step above e is a delicate matter and we do not advice to do it on a live website. Please do it on a copy of the website first to make sure it works.
Thanks for your help with this however we can't run those SQL command now because we already managed to fix it.
We noticed that one of the subsite in the multisite instance got stuck back on the WPML onboarding process - I suspect this may be due to some corrupt database entries.
Following through the onboarding process, it did prompt us to select a default language which fixed the issue for our end.