This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing database errors on your translation dashboard with WPML when using a custom database prefix (not the default "wp_") and your site supports 30 or more languages, this might be due to hard-coded database prefixes in the WPML plugin code.
Solution:
First, ensure you have a full backup of your site. Then, navigate to the following files and make the specified changes:
/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/Infrastructure/WordPress/Component/Item/Application/Query/SearchQuery/QueryBuilder/ManyLanguagesStrategy/SearchQueryBuilder.php
Replace:
LEFT JOIN wp_icl_translations target_t ON target_t.trid = source_t.trid AND target_t.language_code IN ({$gluedEscapedLanguageCodes})<br />LEFT JOIN wp_icl_translation_status target_ts ON target_ts.translation_id = target_t.translation_id
With:
LEFT JOIN {$this->queryPrepare->prefix()}icl_translations target_t ON target_t.trid = source_t.trid AND target_t.language_code IN ({$gluedEscapedLanguageCodes})<br />LEFT JOIN {$this->queryPrepare->prefix()}icl_translation_status target_ts ON target_ts.translation_id = target_t.translation_id
Apply the same changes in:
/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/wpml/src/Infrastructure/WordPress/Component/Item/Application/Query/SearchQuery/QueryBuilder/ManyLanguagesStrategy/SearchPopulatedTypesQueryBuilder.php
This modification ensures that the query uses the correct custom prefix instead of the hardcoded 'wp_'.
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If problems persist, please open a new support ticket.
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.