Home Forums General Issues Migrating existing post_meta fields into ACF Repeater sub fields


Migrating existing post_meta fields into ACF Repeater sub fields

  • Any experience with migrating existing post_meta into an ACF repeater?

    I am migrating an existing site that has some custom fields that are saved as serialized arrays, but I want to be able to use them with an ACF repeater field going forward.

    If anyone has an example of how I’d manually insert the data to be used by the repeater field, that would be extremely helpful.

    My plan is to create new field groups for the existing fields and run a migration routine to populate them with data.

    I believe I would need to copy the post_meta over into the new field name, and also create another key prefixed with an underscore to hold the new ACF field key value. I just want to know how to correctly format the keys and data to be able to migrate existing data into a repeater field.

  • Nevermind, I was able to figure this out using the documentation for the update_field() function.

    Examples are given on that page for inserting/updating ACF fields including the repeater and flexible content fields.

    Updating with the field_key adds all the necessary reference fields as well, so this was much easier than I thought. Thanks!

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

The topic ‘Migrating existing post_meta fields into ACF Repeater sub fields’ is closed to new replies.