Skip Navigation

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

Problem:
The client is running a loop to clean up each subsite's WPML tables in a multisite install, specifically targeting untranslated strings and optimizing tables. They are concerned about whether deleting strings with certain statuses might affect essential translations or other database elements.
Solution:
We advised the client that while it is generally safe to delete entries from the

wp_icl_strings

table where the status is '0' (indicating untranslated strings), they should avoid deleting data from the

wp_icl_string_packages

table, as it contains crucial string packages necessary for page translations and other elements. We recommended using WPML's tools for safely cleaning up unused data and provided a link for further guidance: WPML Tables Documentation and Reducing Size of WPML Tables. Additionally, we emphasized the importance of performing a full backup before proceeding with any deletions and checking the system after making changes.

If this solution does not apply to your case, or if it seems outdated, 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. Should you need further assistance, please open a new support ticket at WPML Support Forum.

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 1 voice.

Last updated by vincentP-19 1 day, 12 hours ago.

Assisted by: Bruno Kos.

Author Posts
February 8, 2025 at 9:15 pm #16683195

vincentP-19

Background of the issue:
We have a multisite install and are running a loop to clean up each subsite's WPML tables. The process involves deleting untranslated strings and optimizing the affected tables using the following queries:
DELETE FROM `wpif_{$site_id}icl_strings` WHERE `status` 10;
DELETE FROM `wpif_{$site_id}icl_string_translations` WHERE `status` 10;
TRUNCATE TABLE wpif_{$site_id}icl_string_pages;
TRUNCATE TABLE wpif_{$site_id}icl_string_urls;
OPTIMIZE TABLE `wpif_{$site_id}icl_strings`;
OPTIMIZE TABLE `wpif_{$site_id}icl_string_translations`.

Symptoms:

Questions:
Please validate that we understood right; this will delete any incomplete translations and to refill the tables (if need be), we can go ahead and scan the theme/plugins.
Are there other tables that should be emptied to further clean the database considering we have a high volume of subsites?

February 10, 2025 at 2:34 pm #16688057

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Welcome to the WPML support forum. Before passing this thread to my colleague, I would like to share some suggestions and possible solutions for the issues you mentioned.

To help you faster, I've enabled debug information for this support ticket. Please see this link for how to get this information from your site and give it to us: http://wpml.org/faq/provide-debug-information-faster-support/

Instead of deleting the tables directly from the database (which is not officially recommended ), the best option to clear the WPML data (including the translations) will be WPML Reset or WPML Troubleshooting. Because it is connected with multiple tables and may result in fatal errors - https://wpml.org/documentation/support/wpml-tables/

Refer to the following documentation for more details.

https://wpml.org/documentation/support/wpml-troubleshooting-options/

https://wpml.org/documentation/getting-started-guide/language-setup/deleting-languages-and-plugin-data-by-doing-a-wpml-reset-on-your-site/#step-3-do-the-wpml-reset

https://wpml.org/forums/topic/cancel-all-translation-jobs/#post-13887567

https://wpml.org/faq/translation-status-stuck-or-displaying-the-error-wpml-didnt-manage-to-translate-this-page/

https://wpml.org/documentation/getting-started-guide/string-translation/#how-to-delete-a-string

Please take a full site backup {mandatory} if you are resetting. Because once reset it will not be possible to recover.

--
Thanks!

Bigul

February 10, 2025 at 2:39 pm #16688070

vincentP-19

Thank you for the suggestions. Sadly, reseting seems to remove everything while we only want to remove untranslated/unused data in our large-scale installation.

Ideally, we need a suggestion that can be done programmatically since this would need to be done on 300+ sites. (it's a multisite)

Thank you for your assistance!

February 11, 2025 at 2:27 pm #16692148

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Based on https://wpml.org/documentation/support/wpml-tables/, some database table entries are interconnected. Deleting them without caution may result in fatal errors or issues with future translations. To address this, WPML provides various tools to safely clean up unused data.

However, in the `wp_icl_strings` table, the `status` column indicates whether a string has been translated. A value of `0` means the string is untranslated and may be safe to remove, as these entries originate from the String Translation feature.

So something like this:

DELETE FROM wp_icl_strings
WHERE status = 0;

However, you should not delete data from the `wp_icl_string_packages` table, as it contains string packages that are integral to page translations and other related elements.

For additional guidance, refer to this resource: https://wpml.org/errata/reducing-size-of-icl_translate_job-icl_translate-and-other-wpml-tables/

In any case such deletions can have a risk of issues with present/future translations, so I advise a full backup and additional checks after this.

February 11, 2025 at 2:54 pm #16692451

vincentP-19

Thank you,
Considering we use no WPML feature aside from String Translations. Are the other strings with a status different than "10" worth keeping?

February 12, 2025 at 7:00 am #16694194

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

It would not be safe, as it could result in the deletion of essential translation strings, including Gutenberg-based content, Gravity Form translations, and other grouped elements, such as all strings associated with a page built using a page builder.

packages.png
February 12, 2025 at 1:04 pm #16696475

vincentP-19

Thank you, that explains it well!
We'll proceed with deleting strings/translations with status 0 only after a backup.