True on successful update, false on failure.
However, I get false even though update is successful?
I know that the result returns false if the old value and new value is equal, but in my case, it returns false even if:
1) old value !== new value
2) I see it updates just fine
I tried one of the examples in the documentation :
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.
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.
Viewing 2 posts - 1 through 2 (of 2 total)
The topic ‘update_field() returned true/false not reliable?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users