Home › Forums › General Issues › Adding rows into a Repeater Field programatically › Reply To: Adding rows into a Repeater Field programatically
Inserting repeater fields into the DB is something I’ve just needed to do myself. There are a lot of fields to deal with.
Each repeater field contains the number of rows of sub-fields.
Each sub-field is actually named {repeater-name}_{count}_{subfield-name}
So you need to insert the number of rows into “latlng_repeater”
then for each row, say you have 2, you insert the values into:
To top this off, each of these fields has a corresponding field that starts with an _ whose value is the ACF field key. I had cases when working on my import where I needed to insert these values to get the field values to show on the front end without needing to open and save every post in the admin. I also has some cases where the imported values did not even appear in the admin without inserting these.
You really need to add some posts with all of the fields and then dig around in the database to figure out what you need to insert.
Hope that helps.
~JH
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.