Home › Forums › Backend Issues (wp-admin) › update_field() issues › Reply To: update_field() issues
Thanks for the input Jonathon. While the code example you provided caused some issues (including an infinite loop when I added the post_id to the have_rows() function!), the field key suggestion was instrumental in solving it. What does work is this:
if (false == update_sub_field(
array('repeater_key', 1, 'sub_field_name'),
$value,
$postId
)) {
update_field(
'repeater_key',
array(
array('sub_field_name' => $value)
),
$postId
);
}
The difference is using the repeater’s key instead of name in the update functions.
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.