Home › Forums › Front-end Issues › $post->meta_field returning count for repeater field › Reply To: $post->meta_field returning count for repeater field
How is the data saved?
The repeater field saves all it’s data in the wp_postmeta table. If your repeater field is called “gallery” and contains 2 sub fields called “image” and “description”, this would be the database structure of 2 rows of data:
// meta_key meta_value
gallery 2 // number of rows
gallery_0_image 6 // sub field value
gallery_0_description "some text" // sub field value
gallery_1_image 7 // sub field value
gallery_1_description "some text" // sub field value
that means:
try this:
$post->repeater_0_subfield //for first row
$post->repeater_1_subfield //for second row
...
or create a foreach or a while loop: described here
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.