Home › Forums › Add-ons › Repeater Field › Programmatic create repeater field
I want to use repeater fields for my clients application.
The only problem is, that it already has a pretty big DB that needs to be transferred.
How can I create the repeater fields programaticaly ?

Hi @hannit
Are you talking about importing data into WP including the repeater field?
There is a PW plugin which can handle this for you!
http://www.wpallimport.com/documentation/add-ons/advanced-custom-fields-add-on/
Thanks
E
Nope.
My base site is not WP, I’m migrating it into WP and want to use repeater fields.
I need to migrate the data from the old site to the new one, wich will be done programatically. So I need to assign data to these repeater fields using progamatic API.
How can I do that?

Hi @hannit
Thanks for the follow up.
ACF contains a simple function called update_field. You can read about it here:
http://www.advancedcustomfields.com/resources/functions/update_field/
To save the repeater field, you will need to save the $value as a multidimensional array.
The $value will be an array where each piece is another array. This represents each row.
In each row array, you will need to define the sub field values. This can easily be done using the sub_field name as the key, and the sub_field value as the value.
Thanks
E
Hello @elliot
Thank you for the excellent products!
I have been looking at as many resources as I can find online, trying directly calling update_field() as well as using acf/load_value, but I cannot seem to set a repeater field on a newly created page (all in code). Do you have any code snippets wherein a page is created and then an acf repeater field is successfully populated and then read back?
Thank you
Jasper
The topic ‘Programmatic create repeater field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.