Support

Account

Home Forums ACF PRO Add Row for Repeater inserts blank data

Helping

Add Row for Repeater inserts blank data

  • Hi All,

    Hoping someone can put me out my misery.
    I’ve got the below code:

    			$key = 'field_5947dbbd8c36d'; #repeater field NOT sub fields!
    			$value[] = array(
    				"field_5947dbd28c36e" => $line[0],
    				"field_5947dbd78c36f" => $line[1],
    				"field_5947dbdc8c370" => $line[2],
    				"completed" => ''
    			
    			);
    			echo $line[0].'<br>';
    			echo $line[1].'<br>';
    			echo $line[2].'<br>';
    						
    			add_row( $key, $value, $post_id );

    When I run the script with this in, it creates the rows, however, it doesn’t insert the data.

    I know from echoing out the content, it’s there, however , it simply won’t add the row with the content.
    Am I missing something obvious? I’ve tried using field names and field keys, I’ve also tried hard coding the data instead of $line[0] for example but still no joy.

    Thanks in advanced

  • I’ve switched to:

    			$row = array(
    				'field_5947dbd28c36e'	=> $line[0],
    				'field_5947dbd78c36f'	=> $line[1],
    				'field_5947dbdc8c370'	=> $line[2],
    				'field_5947dbe48c371' => ''
    			);
    			
    			$i = add_row('field_5947dbbd8c36d', $row, $post_id);	

    And hey presto!

    Apologies

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

The topic ‘Add Row for Repeater inserts blank data’ is closed to new replies.