Home Forums Add-ons Repeater Field ACF add_row works incorrect Reply To: ACF add_row works incorrect

  • I did a test where I set up a repeater with a post object field and a multi select as sub fields, added code to create a new row and it worked as expected. My code was extremely simple, it just inserted a new row on the current post when you visit the page on the front end.

    $post_ID = $post->ID;
    $row = array(
      'field_56c3a78ded331' => 196,
      'field_56c3a7c0ed332' => array(1,3,5)
    $row_id = add_row('field_56c3a77aed330', $row, $post_ID);

    This leads me to believe that there is something that’s interfering with ACF. Especially since you say these are the values you say are being inserted.

    locations_repeater - 1
    _0_field_565eadf99195b - 563
    __0_field_565eadf99195b - '' (empty)
    _0_field_565eae049195c - a:1:{i:0;s:9:"sport";}
    __0_field_565eae049195c - '' (empty)

    What should be in the DB after the insert is this:

    locations_repeater - 1
    _locations_repeater - field_565eadcd9195a
    locations_repeater_0_location_select - 563
    _locations_repeater_0_location_select - field_565eadf99195b
    locations_repeater_0_available_sports - a:1:{i:0;s:9:"sport";}
    _locations_repeater_0_available_sports - field_565eae049195c

    So we need to figure out what’s causing this to happen. You’ll need to start by disabling plugins and switching to a default theme. If you can figure out where the interference is coming from then we might be able to figure out how to fix it.