Home › Forums › General Issues › update_field() returned true/false not reliable? › Reply To: update_field() returned true/false not reliable?
So, the issue here is that you’re using a repeater field.
The repeater meta key is job_salary
and it contains the number of rows in the repeater. Assuming the repeater already has 1 row and you are updating that row, it still has 1 row so no change has been made to the meta value of repeater field even if sub fields have been changed.
I’m not sure I know of any way around this.
You could attempt to call update_field for the sub fields using their actual meta key, but I really don’t know if this will work.
update_field('job_salary_0_is_negotiable', 'true', $post_id);
update_field('job_salary_0_depends_on_experience', 'false', $post_id);
However, I do not know that this will work and even if it does I know that it will not work if the repeater in question will be updated correctly, especially if the repeater does not already have a value.
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!
The most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 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.