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.
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?
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.
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.
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)
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.
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.