Support

Account

Home Forums ACF PRO repeater or group child/sub fields issue

Solving

repeater or group child/sub fields issue

  • Hi,
    i have latest version of acf pro = 5.8.11, wp = 5.4.1 issue is that some fields i have which admin we can edit as admin and soem fields user fill up in frontend but issue is that if we are trying to update from frontend than those changes do not display on backend and vice versa.
    check video https://drive.google.com/file/d/1Z2xGdsbPMy4AYnnXnjNgaVUG9oH4K8-u/view

    here is my code

    <?php // loop through the rows of data
    while (have_rows('legal_requirements')) : the_row();
    if (have_rows('death_registration')) : //child group field
    while (have_rows('death_registration')) : the_row();
    
    // display a sub field value
    echo '<tr class="d-flex"><td class="col-5">';
    the_sub_field('register_the_death');
    echo '</td>'; ?>
    
    <td class="col-3">
    <?php the_sub_field('registration-to-do');
    echo '</td>';
    
    echo '<td class="col-3">';
    the_sub_field('registration-result');
    
    echo '</td>'; ?>
    <td class="col-1"><?php
    $todooptions = array(
    'fields' => array(
    'field_5edc1d8ee4926'
    ),
    'form' => true
    // 'submit_value' => 'Save Cost'
    );
    acf_form($todooptions); ?></td>
    </tr>
    <?php endwhile; ?>
    <?php endif; ?>
    <?php endwhile;
    ?>
  • You cannot only include sub fields when using an ACF form. ACF form can only work if the Repeater=>Group=>child fields are all shown and the structure is maintained. When you include only the child fields then ACF assumes that these will be saved at the top level rather than as rows of a repeater.

    To to this you need to build your own form and then build an acf/save_post filter that takes the values submitted and updates the fields correctly.

  • hi, should i use acf_form(); too while calling fields into single post template

    $options = array(
                                                'fields' => array(
                                                    'field_5edaf9ab608b8'
                                                ),
                                                'form' => true,
                                                // 'submit_value'    => 'Save Cost'
                                            );
                                            acf_form($options)

    i have tried to add save_post action but it is not working not saving any values

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

The topic ‘repeater or group child/sub fields issue’ is closed to new replies.