Home Forums ACF PRO Possible to use update_field to append data to repeater?


Possible to use update_field to append data to repeater?

  • I’d like to append a row of data to a repeater field, one by one. Currently, I have update_field functioning properly, but it does not append data in the correct way. As it is now, every time I update a front end form (I have hundreds), each form just updates 1 row and overwrites the existing data.

    Per this thread:, Elliot mentions that the update_field function does not append data, but rather updates the entire repeater row /s.

    My question: Has anyone successfully appended data to an existing repeater field? Where would I start or look to build a function to do that? Store the data in another array to be submitted all at once via update_field? Would appreciate anyone pointing me in the right direction.

  • Solved it! I just need to check if there were already existing rows, and append data to that array.

     if( have_rows('directories', $id) ){
                            $value = get_field( 'directories', $id );
                          } else {
                            $value = array();
                          /*==========  Add New Row  ==========*/
                          $value[] = array(
                            'field_53ed47e4824fd' => $attachment_id, 
                            'field_555caf66e22a3' => $note,
                            'field_53ed1cd943477' => $date,
                            'field_53ed1b70f2796' => $list_ID,
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.