Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 3.5.1.1

Resolved in: ACFML 0.5

Overview of the issue

You might experience a slow saving time when using ACF Pro plugin and WPML Translation Management.

Workaround

No workaround is available at this time.

We are working to improve the compatibility class that is causing this issue.

15 Respostas para “Performance issues when updating posts and pages with ACF Pro and Translation Management active”

  1. I noticed we had some issues with a query that is using REGEXP instead of LIKE in the update_post_meta_settings() function. You moved the function to the ACFML glue plugin, but I still see the REGEXP in those files. We have a lot of records in our posts and postmeta tables, and the REGEXP was causing that single query to take multiple seconds depending on how many fields there were. Changing it to LIKE made it much faster!

    Since I hate modifying plugin files, what I did as a quick and dirty fix was add this to functions.php:

    add_filter(‘query’, ‘modify_bad_wpml_query’);
    function modify_bad_wpml_query($query) {
    if(is_admin() && strpos($query,’SELECT DISTINCT meta_key’) !== false && strpos($query,’REGEXP’) !== false) {
    $query = str_replace(‘REGEXP’,’LIKE’,$query);
    $query = str_replace(‘[0-9]*’,’%’,$query);
    $query = str_replace(‘^’,”,$query);
    $query = str_replace(‘$’,”,$query);
    }
    return $query;
    }

    • Oops, I should have put that in code tags, since it converted it to smart quotes.


      add_filter('query', 'modify_bad_query');
      function modify_bad_query($query) {
      if(is_admin() && strpos($query,'SELECT DISTINCT meta_key') !== false && strpos($query,'REGEXP') !== false) {
      $query = str_replace('REGEXP','LIKE',$query);
      $query = str_replace('[0-9]*','%',$query);
      $query = str_replace('^','',$query);
      $query = str_replace('$','',$query);
      }
      return $query;
      }

      • Hi Dave,

        Thanks a lot for the feedback – this is very helpful.

        We are adding this to our next development cycle, I’ll update on our blog when it’s published.

      • Hello Dave. I got down to work on it today, but actually I cannot force this update_post_meta_settings() function to run. When exactly this is executed? Could you provide me some scenario? The best would be to get steps from very beginning (like you have only wp + plugins installed and it is new installation)

        • Hi, Konrad! Thanks for working on this. Unfortunately, I don’t have time to test and provide exact steps, but looking at the code, it appears to run in the following scenario:

          With the Translation Management and ACF Pro plugins active, update a translated post that has repeater fields using the default WordPress editor.

          The save_post() hook in classes/class-wpml-acf-xliff.php of the glue plugin checks for is_updating_a_translatable_post_with_acf_fields(). Note also that update_post_meta_settings() has a condition that checks for the reg_ext_patterns array. I’m not sure if non-repeater fields would appear in that array or not (I’d have to test), but I know that repeater fields do because they have those numbers in the meta key names. (“field_0_field”,”field_1_field”, etc.) You’ll want to have them in your test post if for no other reason than that’s what slows things down.

          – Becky (logged in as Dave, sorry!)

        • I should add that I’m not sure if you HAVE to use the default editor, or if it HAS to be the translated post that you update, but that is the scenario we had when I ran into the problem, so it might be best to start there!

          • Hi, thank you. It took a while but I’m glad to inform that this change will be released as ACFML 0.5. I don’t know when exactly, but if you want to test it, I can share a beta with you.

  2. Someone can say me if this issue concern also the plugin WP-TYPES or only ACF ? Because, I experiment very slow dashboard in a WooCommerce with WPML, few custom post types and WP-TYPES…

    I already tried dozen of usual procedures describes on the support forum. Each points ! I’m hosted on a VPS SSD 4Gb RAM with PHP 5.6, MariaDB 10.1 (using ET Divi Theme).