Home Forums Add-ons Repeater Field ACF 5.0+ Dynamically Populating Repeater Reply To: ACF 5.0+ Dynamically Populating Repeater

  • The solution is a bit messy and filled with a bunch of my classes functionality that won’t make much sense.

    The gist is that:

    • Repeaters need an integer count of expected subfields returned as a value from this hook.
    • Subfields names are prefixed with the parent repeater name.

    What I did was check the field type against ‘repeater’ and returned my custom database value count. At the top of the hook I checked if the $field[‘parent’] was empty, if not I used get_field_object( $field['parent'], $post_id, false, false ) to get the parent field name that the subfield are prefixed with.

    Once I returned the count to the repeater and stripped the parent name prefix off the subfields I was able to prepopulate the repeater with my custom table data. I have no idea if this will be helpful to anyone but at least it’s no longer a niche issue on the forums here.