Support

Account

Home Forums Add-ons Repeater Field Repeater field add new row

Solving

Repeater field add new row

  • Hi,
    I have this code, it is supposed to add a new row to my repeat field, but it replaces the existing row instead, Can someone help me with this?

    	
            $existing = get_field( 'field_6044ccf9a0325',$post_id);
    	if ( ! is_array($existing) ) $existing = [];
    	
    	$field_key = "field_6044ccf9a0325";
    	$additions = [
    			[
    			"member"   => $applicant_userid,
    			"application_date"   => $today,
    			"group_status"   => "pending",
    			"payment_status"   => "pending_payment",
    			],
    	];
    
    	$updated = $existing + $additions;
    	update_field( $field_key, $updated, $post_id);
  • Try using field keys for the sub fields as well.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.