Support

Account

Home Forums General Issues update_row() does not return true anymore? Reply To: update_row() does not return true anymore?

  • I followed this through the functions. ACF update_row() ultimately returns what the last call returned by update_post_meta() or one of the other function that gets called in WP. In WP, if the current value is the same as the old value then update_post_meta() returns false.

    update_row() starts out by getting the value for the entire repeater and then replacing array for the one row and then updating the entire repeater field.

    Fields in ACF are updated by applying acf/update_value filters and in the case of a repeater all the sub fields are updated by a filter in ACF which returns the number of rows.

    The last thing that gets update by ACF is the meta field that holds the number of rows and since the number of rows is the same wp_update_meta() returns false.

    Anyway, I know that probably didn’t help you, but it explains why it always returns false, because the number of rows is not changed. I don’t know if this is a bug or not, and after spending time looking at it, I don’t know that there is any way to fix it. I’m pretty sure that update_value() on a repeater when you’re updating an entire repeater and it contains the same number of rows would have the same result.

    After looking, the only way I can see for you to know if a value is changed would be to loop through each sub field and use update_sub_field() on each https://www.advancedcustomfields.com/resources/update_sub_field/, but I did not dig into that one.