Home Forums Add-ons Repeater Field Getting repeater subfields outside the loop


Getting repeater subfields outside the loop

  • Hi, I’ve been looking for quite a while within the forum but haven’t found the answer so asking here. Please forgive me if this has come up before.

    I want to query the subfields of a repeater field from within an ADMIN-AJAX call, so outside of any loop and without having to provide a postid.

    I can get info on the field by using but it doesn’t return subfields.

    _acf_get_field_by_name( 'fieldname' )

    And I can get the the subfields of that fieldname only if I provide a postID.

    get_field( 'fieldname' , $postID )

    but how can I get a list of fieldnames associated without a repeater-name WITHOUT a postid?

    I have thought about using the wp_postmeta table but I can only find subfields there if they are used on a post. Preferably I want them even without them being filled out.

  • Ok, so after some frustration I got back to what I already had. Went back over the field_groups and over all the fields. When I found that particular fieldname there also were all the sub_fields.
    So something like this (typing this out, not copying):

    $groups = acf_get_field_groups();
    for ($i=0;$i<sizeof($groups);$i++) {
      $custom_fields = acf_get_fields( $groups[$i]['ID']);
      var_dump( $custom_fields);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Getting repeater subfields outside the loop’ is closed to new replies.