WPML error due to missing index: Table wp_options is filled up with multiple entries of wpml_translation_services

One of our users was running WP Staging Pro alongside WPML (inc. translation management) on a couple of websites. On one, in particular, pushing the staging to live site using WP Staging Pro immediately causes the wp_options table to fill up with entries with the wp_name of ‘wpml_translation_services‘. As soon as these were deleted, no further entries were created… until the next push from staging to live.

We’ve tracked this entry down to WPML translation management.

If only WP Staging Pro or WPML translation management is installed, this entry is not created, but when both are installed and changes are pushed from staging to live, the problem reappeared on this special website.

The WPML support provided us with a solution to this issue that we want to publish here for anyone else with the same error:

It looks like the issue has happened because the indexing is missing on the wp_options table. The index of options table is very specific and crucial and every plugin or theme could create issues if it is missing.

Please try the following steps after a full site backup:

1) Log in to the Database server using PHPMyAdmin or similar tools
2) Choose the Database and run the following queries first

DELETE
FROM `wp_options`
WHERE `option_name` = 'wpml_dependencies:needs_validation';

DELETE
FROM `wp_options`
WHERE `option_name` = 'jetpack_callables_sync_checksum';

DELETE
FROM `wp_options`
WHERE `option_name` = 'gf_upgrade_lock';

DELETE
FROM `wp_options`
WHERE `option_name` = 'wpstg_license_key';

DELETE
FROM `wp_options`
WHERE `option_name` = 'wpstg_license_status';

DELETE
FROM `wp_options`
WHERE `option_name` = 'wpstg_settings';

DELETE
FROM `wp_options`
WHERE `option_name` = 'fs_accounts';

DELETE
FROM `wp_options`
WHERE `option_name` = 'jetpack_plugin_api_action_links';

DELETE
FROM `wp_options`
WHERE `option_name` = 'jpsq_sync_checkout';

DELETE
FROM `wp_options`
WHERE `option_name` = 'stats_cache';

3) Then run the following query to index the options table

ALTER TABLE `wp_options`
ADD UNIQUE `option_name` (`option_name`);

4) Create a new staging site, because may there may be a strong chance to have the same bug with the existing staging site.

5) Make changes on the new staging site and push to live site

6) Then please check you are getting multiple entries for *wpml_translation_services* or not

Author: Rene Hermenau

I'm René Hermenau, founder of WP STAGING. I've been building WordPress infrastructure software since 2013 and writing code on GitHub since 2011. My repos live at github.com/rene-hermenau. WP STAGING started as a small developer project solving the same problem I kept hitting on client work: there was no fast, safe way to clone a WordPress site for staging or migration without breaking serialized data, file paths, or media references. Today we are a team of more than 10 people. The free plugin runs on hundreds of thousands of WordPress installations, and the Pro version powers backup, migration, and staging workflows for agencies, hosting platforms, and ecommerce stores. I'm still hands-on with the codebase and technical architecture. Our releases are built as a team, but many of the core architectural decisions are ones I helped design, test, and evolve over the years: how we handle large database exports, how we keep memory usage flat on multi-GB sites, and how we make migrations atomic against partially written tables. "When you touch code, leave it 10% better than before and write a test." If you're stuck on a WP STAGING question, the docs are at wp-staging.com/docs. If you hit a bug, file it on GitHub at github.com/wp-staging. Our team reads everything that lands there.