Home Forums Add-ons Repeater Field Repeater inside a group Reply To: Repeater inside a group

  • Hi Simon,

    I guess ‘field_64e76f9210338’ is your group field key.
    If that’s the case, i don’t think you need it if you only want to update your repeater inside your group.

    Maybe you could try something like the code below.
    Let me know if it helps you.


    //be sure that's your repeater key
    $repeater_key = 'field_64e765bfc42ef';
    $repeater_name = 'your_rep_name';
    //$rep_count will be used to create a new repeater OR add rows to an existing repeater
    $rep_count = count(get_field($repeater_name)); //not sure if it works with field key
    foreach ($event->lineup as $item) {
    	$updated_rep = []; //Not sure if this is needed - it won't hurt
    	//Create an entirely new repeater
    	if($rep_count === 0) {
    		$new_rep = array(
    				'field_64e770e717754' => $item->details,
    				'field_64e770f317755' => $item->time
    		update_field( $repeater_key, $new_rep, $post_id );
    	//Or keep previous values and add new rows
    	elseif($rep_count >= 1) {
    		$new_row = array(
    			'field_64e770e717754' => $item->details,
    			'field_64e770f317755' => $item->time
    		add_row($repeater_key, $new_row, $post_id);