Support

Account

Home Forums Front-end Issues Update parent and child repeater programmatically Reply To: Update parent and child repeater programmatically

  • From what I can see you are updating a subfield for a repeater that does not exist yet and then you’r updating the repeater with empty information except for the title.

    When updating a repeater field the value $data should be a multidimensional array.

    
    $data = array(
      // array element for each row
      array(
        // an element for each field
        // since field does not exist always use field keys
        'field_123345' => 'value for field 1',
        'field_234567' => 'value for field 2',
        'field_456789' => 'value for field 3',
        // etc...
      ),
      array(
        // an element for each field
        // since field does not exist always use field keys
        'field_123345' => 'value for field 1',
        'field_234567' => 'value for field 2',
        'field_456789' => 'value for field 3',
        // etc...
      )
    );
    
    update_field('field_key_for_repeater', $value, $post_id);