Home Forums Add-ons Options Page Using acf/load_field to populate values? Reply To: Using acf/load_field to populate values?

  • Well in my case I am using acf/load_field to load form fields dynamically for each post in a loop, similar to this example:

    if( $loop->have_posts() ):
        while( $loop->have_posts() ): $loop->the_post();
        $id = get_the_ID();
        if( function_exists('acf_add_local_field_group') ):
          'key' => 'field_product_item_' . $id,
          'title' => 'Product Item #' . $id,
          'fields' => array(
              'key' => 'field_product_item_group_' . $id,
    	  'type' => 'group',
              'sub_fields' => array()
               //... dynamic items with default values will be added to this sub_field using acf/load_field
        add_filter('acf/load_field/key=field_product_item_group_' . $id, 'load_product_details_form', 20, 3);

    So this approach seems to work so far. Anyway I hope this is not prone to problems in the future.