Support

Account

Home Forums Add-ons Repeater Field Get all Fields & Sub Fields of a POST ( Repeater) Reply To: Get all Fields & Sub Fields of a POST ( Repeater)

  • If you want to return all the fields of a field group you can use

    
    $fields = acf_get_fields($group_key);
    

    if you want to get all the field groups for a post

    
    $groups = acf_get_field_groups(array('post_id' => $post_id));
    

    putting them together

    
    $groups = acf_get_field_groups(array('post_id' => $post_id));
    if ($groups) {
      foreach ($groups as $index => $group) {
        $groups[$index]['fields'] = acf_get_fields($group['key']);
      }
    }
    echo '<pre>'; print_r($groups); echo '<pre>';