Home Forums ACF PRO Possible bug with update_sub_field() function


Possible bug with update_sub_field() function

  • Hi there, I’ve sent a support ticket but I thought I’d post here as well to see if anyone else has encountered this issue.

    I’m attempting to update/add rows with multiple values to a repeater field using the update_sub_field function. My use case is actually pretty similar to the documentation.

    I’ve confirmed that the fields are being added properly to the postmeta tables, so it seems that the function itself is working, but the problem is that none of the fields added programmatically actually show up on the post edit screen in the ACF repeater rows. Is this a known issue? Any information would be appreciated, I’m also happy to help the devs troubleshoot, thanks! -Matt

  • The plot thickens. I think I’ve figured out what’s going on but not sure. It seems that the repeater field stored in the post_meta table shows as 0 and that number doesn’t change when the update_sub_field() function is called. Not sure if this was working in an earlier version, but it’s not working in 5.2.5.

  • Hi @oppodeldoc

    Actually update_sub_field does not have the ability to create new rows in a repeater or flexible field. It can only update existing sub fields

    However I’ve posted a solution here which you should be able to use to figure this out:

    Good luck and let me know if that doesn’t do it for you 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Possible bug with update_sub_field() function’ is closed to new replies.