Resolved

Reported for: WPML Multilingual CMS 3.1.9.7

Resolved in: 3.2

Symptoms

Pages become unusable or very slow to load.

If you can monitor which queries are ran, you will find references to this one:

SELECT meta_key
FROM wp_postmeta
GROUP BY meta_key
ORDER BY meta_key
LIMIT 1000;

Workaround

You need to make a small edit in one file of WPML.

You can use an FTP client to edit this file.

  1. Open wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php
  2. Go to line 102, where you must see this line:
    $this->initial_custom_field_translate_states();
  3. Comment that line, by adding “//” at the beginning of it.
  4. Save the file

Once you do that, nothing is supposed to change (except the performances, which can considerably improve). There are no side-effects to this change. You are commenting out code which used to do something, but isn’t necessary any more.

We have noticed a peak of queries getting executed on both back-end and front-end. This only effects very very large sites with millions of postmeta entries (like we have on our sites).

This query comes from an old logic, which isn’t really doing anything important anymore. We’re removing it entirely in WPML 3.2.

If you notice a huge peak in loading pages, this may be your case.

However, please note that since WordPress 4.2 changed the charset to UTF8-bytes, many other plugins and the theme may show performance problems. This upgrade may change indexing (as has happened on our server) and may have unexpected interaction with MySQL (as we have experienced). This causes things that were very low-impact to suddenly become critical.

So, our advice is to enable the slow queries MySQL log and check which queries are really effecting your server’s performance.

3 Responses to “Performance problems related to custom fields, after upgrading to WordPress 4.2.1”

  1. Hi,

    I tried the solution above and no results occurred. What other solutions can we look at? Also, I am having trouble using the wpml string translation for woocommerce to italian. It does seem to work. Thanks.

    • Davide, please post a thread in our support forum: we don’t have the means to provide you with proper support from here, as we need additional information, some of which might be too private to share here.