Support

Account

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

Solved

Migrating existing post_meta fields into ACF Repeater sub fields

    • jjeaton

    • November 8, 2013 at 8:13 am

    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.

    • jjeaton

    • November 8, 2013 at 12:59 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.