Background of the issue:
From WPML > Support > Troubleshooting > Check from string issues, I get over 25000 strings
Which means I have over 25000 strings that are "not used or linked to the wrong translation data"
I understand I should get rid of them.
I also know I could adjust my server settings to allow longer/bigger requests. But let's face it: it's an edge case, and I won't make this setting adjustment for this request only, considering it will cause other issues (security, ...).
Symptoms:
Removing it through the interface doesn't work : I won't go through 265 pages of 100 results and click delete.
Alternatively, I know I can display all the results and tick them all and remove them all at once.
Unfortunately, the request will fail since it's way, way too long to process.
Questions:
Should I really get rid of these values, and if so, how can I do it efficiently? There must be a way. Thanks
It requires reloading back-end pages with an added url parameter to trigger the code a few times. It will delete strings 5000 at a time.
So, the steps are
- Take a backup
- Make sure you have taken a backup.
- Add the attached plugin file to the plugins/ folder and activate the plugin.
- Visit the site dashboard, then append ?delete_strings=1 to the URL and reload.
- You should get a message saying that x number of strings have been deleted.
- Refresh the page as many times as needed until it says there are no strings to delete.
- Go to the troubleshooting page and click the button to check from string issues again, which should now show 0 strings needing deletion. (This code uses the same query as on that page.)
- Also from troubleshooting, run the "Cleanup and Optimize String Tables" step.
- Deactivate and remove the plugin.
Link to plugin: hidden link
Please get back to us and let us know if this works.
- Is it necessary, or advised to get rid of these values?
- Are these all outdated, or wrong?
- What may I miss after removing them?
- Should I expect performance improvements after deletion, better stability, ...?
1) It is not necessary, it is only advised if you wish to do a clean up of unused / not translated strings.
2) No they are not, most of them are not used / translated so you can remove them if you do not wish to translate them. Other might be strings that do not anymore exist in source file, but are still showing in String translation.
3) You should not miss anything, as said there are either not translated or not existing strings or modified from source files and etc.
4) Some small improvements in performance may happen, since some data will be removed, so you can expect a bit lower DB table, which can give slight increase in load time, but probably not that much significant.
Ok, it seems to do the job. I could see it reduced, at each attempt, the remaining amount of values to clear.
Thank you.
If these values are always useless, for all users, whatever the setup, why not adding this script to WPML and run it as a daily cron? It would prevent this list from growing so much.
The script is just a quick workaround fix for your case, not something for general usage, a better solution and implementation from our side would probably be needed, issue is going to be escalated to developer and they will be working on proper fix / solution.