Home Forums ACF PRO load_fields with cloned fields Reply To: load_fields with cloned fields

  • You didn’t mention that the problem was running out of memory.

    It could be that your have_rows() loop is creating an infinite loop, this can happen when using ACF function to load values inside of filters for other ACF functions.

    What you might have to do is use get_post_meta() instead of the ACF functions.

    For example

    $layouts = get_post_meta($post_id, 'blocks', true);

    will return an array of layouts, something like this.

    $layouts = get_post_meta($post_id, 'blocks', true);
    if (count($layouts)) {
      $field['choices'] = array();
      for ($i=0; $i<count($layouts); $i++) {
        if ($layouts[$i]) == 'anchor_point') {
          $title = get_post_meta($post_id, 'block_'.$i.'_title', true);
          $slug = sanitize_title($title);
          $field['choices'][ $slug ] = $title;
        } // end if layouts[$i] is anchor point
      } // end for layouts
    } // end if layouts