# acf_get_fields()

## Description

Retrieves all the fields from a specific field group, returning them as an array of field objects. This function should not be confused with [get\_fields()](https://www.advancedcustomfields.com/resources/get_fields/), which returns an array of field values for a specific post rather than a field group.

## Parameters

```
acf_get_fields( $parent );
```

- `$parent` *(mixed)* *(Required)* The field group’s ID or key.

## Examples

### Basic usage

This example demonstrates how to return an array of fields for a given parent. Note that you will have to replace the field group key shown below with your own.

```
acf_get_fields('group_6525b4469c71d');
```

### Advanced usage

The following example demonstrates how to retrieve the values in the `foreach` for every field contained in the field group and then output them for viewing.

```
$specifications_group_id = 'group_6525b4469c71d'; // Replace with your group ID
$specifications_fields      = array();

$fields = acf_get_fields( $specifications_group_id );

foreach ( $fields as $field ) {
    $field_value = get_field( $field['name'] );

    if ( ! empty( $field_value ) ) {
        $specifications_fields[ $field['name'] ] = $field_value;
    }
}
```