Home Forums Add-ons Repeater Field update_field repeater field order


update_field repeater field order

  • I’ve been working on a front-end interface by which users can add a row to an ACF (Advanced Custom Fields) repeater field. I’ve got this working just fine using the ACF update_field method:

    $field_key = "repeater_field";
    $post_id = "event_123";
    $value = get_field($field_key, $post_id);
    $value[] = array("sub_field_1" => "Foo", "sub_field_2" => "Bar");
    update_field( $field_key, $value, $post_id );

    (from: but realized that this method adds the additional row as the last row in the list.

    Because my particular example will be adding a slide to a slideshow (of which slide information is defined in each repeater field row) as the next slide, I need to be able to specify to which position the new repeater field is added. I am wondering – is this possible within the update_field method, or would I need to add this as a direct mySQL query. Thanks for any help in solving this!

Viewing 1 post (of 1 total)

The topic ‘update_field repeater field order’ is closed to new replies.