Support

Account

Home Forums ACF PRO Add Row for Repeater inserts blank data

Helping

Add Row for Repeater inserts blank data

    • jarvis

    • June 20, 2017 at 1:44 am

    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

    • jarvis

    • June 20, 2017 at 1:57 am

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.