Home › Forums › General Issues › add_row doesn't work the first time › Reply To: add_row doesn't work the first time
Dear, John Huebner!
Why does it work like this?
Structure:
1. repeater – repeater_test
$post_data = array(
'post_title' => $data["main_info"]["company"],
'post_content' => "",
'post_status' => 'publish',
'post_author' => get_current_user_id(),
"post_type" => "companies"
);
$the_record_id = wp_insert_post( $post_data );
add_row("repeater_test", ["test"=>"adding to the row should"], $the_record_id);
But it doesn’t work like this
Structure
1. field group – (group_main_info)
1.2 repeater – (phones)
add_row("group_main_info_phones", ["name"=>"Jon","phone"=>"0897654007"], $the_record_id);
I tried to write element keys and it doesn’t work the same way.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.
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.