Support

Account

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.