Home › Forums › Add-ons › Repeater Field › Save value from update_sub_field › Reply To: Save value from update_sub_field
Finally manage to solve it
Putting the data there was more or less correct like
update_post_meta( "$order_id", $field_rep, $row_no );
update_sub_field(array($field_key_rep, $sub_no, $field_key_sub), $trackno, "$order_id");
Think the main problem was when fetching the information and then doing it with the field names that would not work until the post was updated / saved. Using field_keys did on the other hand work.
if (have_rows($field_key_rep, $postID)) {
$trackingNo = array();
// loop through the rows of data
while (have_rows($field_key_rep, $postID)):
the_row();
// Add to array
$trackingNo[] = get_sub_field($field_key_sub);
endwhile;
}
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.