Home Forums General Issues ACF Performance


ACF Performance

  • I am using ACF to load in custom options for product pages within WooCommerce. I am using this technique ( to dynamically load in options from the Options page onto the product page as checkboxes for the client to check/uncheck which options to show. The product pages have become incredibly slow though (30+ seconds to load the page) (see example here: Any ideas on how I can improve the performance? I can not tell if the issue is there are too many options the client has added to the Options page or if my technique for dynamically pulling in the data just doesn’t scale to the number of options the client needs.

    A sample of the code I am using to dynamically generate the options is below. I have about 15 of these snippets, each for a different section of options:

    function ap_options_handles( $field ) {
      // reset choices
      $field['choices'] = array();
      // load repeater from the options page
      if(get_field('ha_options', 'option')) {
        // loop through the repeater and use the sub fields "value" and "label"
        while(has_sub_field('ha_options', 'option')) {
          $value = get_sub_field('ha_value');
          if( 0 == $value ) $value = 'zero';
          $label = get_sub_field('ha_label');
          $field['choices'][ $value ] = $label;
      return $field;
    add_filter('acf/load_field/name=handles', 'ap_options_handles');

    On the template side, I have the following code for each section to output the options:

              // HANDLES
              $ha_options = get_post_meta( get_the_ID(), 'handles', true );
              //Loop through the options, displaying relevant content
              foreach( $ha_options as $option ) {
                if( have_rows('ha_options', 'options') ):
                   while ( have_rows('ha_options', 'options') ) : the_row();
                      $value = get_sub_field('ha_value','options');
                      if( 0 == $value ) $value = 'zero';
                      $handlesImage = get_sub_field('ha_image','options');
                      if ($value == $option) {
                        echo '<div class="center col-md-3 col-sm-4"><img src="';
                        echo $handlesImage['url'];
                        echo '" alt="';
                        echo $handlesImage['alt'];
                        echo '"><p>';
                        echo '</p></div>';
                else :
                  // no rows found

    I have provided you a login for the site if you would like to go in and take a look. The login info is below:
    user: acf
    password: send in email

  • Hi,

    PS: It is not advisable to share your login credentials on the public forum.

    In order to establish the cause for the slow loading, try deactivating all the other plugins and see if the problem persists.

    Please note the latest version of acf comes an easy way to cache fields using local-json which assist in improving site performance.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘ACF Performance’ is closed to new replies.