Home Forums Add-ons Repeater Field Delete, update and adding rows in template files Reply To: Delete, update and adding rows in template files

  • After a bit more reading i think where i am confused is that maybe that you use update_field each time to add in all rows at once?

    So you’d have a multidemensional array off ‘all’ of the rows which then bulk overrides?

    If so does that mean you use the field_key of the actual repeater?

    udetails – 2
    _udetails – field_532b0f308afe0

    update_field(‘field_532b0f308afe0′, $multi-demensional-array, 512)

    If this is correct what would the array be structured like in my case?

    $multi-demensional-array = array(
    [0] -> array('field_532b122e8afe1' => 'paul', ''field_532b123c8afe2' => 'brown')
    [1] -> array('field_532b122e8afe1' => 'mark', ''field_532b123c8afe2' => 'smith')

    right so i tried this on another post

    $udata = array(array('field_532b122e8afe1' => 'paul', 'field_532b123c8afe2' => 'brown'));	 
    update_field('field_532b0f308afe0', $udata, 654);

    added in perfectly so think i have answered my own question :D. I guess the technique to just amend one row would be to build up the above array with the change and all of the previous data. Seems a bit counter-intuitive but i guess writing an add/delete row function is a pain in the a$$ as you’d have to deal with maintaining the sequential meta keys as opposed to just re-creating them as i assume the update_field function does.