Support

Account

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