Site docs are currently being updated 🚧 Thank you for your patience! 🙏

Group

ACF
Last Upated: Thursday, Feb 1, 2024

group

The Group field is native to ACF (FREE) and provides a way to structure fields into groups. It assists in better organizing the edit screen UI as well as the data.

Types Added to the Schema

Each ACF Field Group is added to the GraphQL Schema as an object type, named using the "graphql_field_name" or "graphql_type_name" field on the field group, implementing the AcfFieldGroup Interface, and containing fields representing the fields of the group.

Resolve Type

Fields of the group type will resolve to the corresponding object type added to the Schema to represent the group.

Field Settings

Below you will find information about how various ACF field settings can impact how the field will map to the GraphQL Schema and/or modify resolution of the field when queried.

Field Configuration

<?php
add_action( 'acf/include_fields', function() {
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
return;
}
acf_add_local_field_group(
[
{
"key": "my_field_group_",
"title": "My Field Group with group",
"show_in_graphql": 1,
"graphql_field_name": "myFieldGroupWithGroup",
"map_graphql_types_from_location_rules": 0,
"graphql_types": [
"Page"
],
"fields": [
{
"key": "my_field_",
"label": "My Field",
"name": "my_field",
"type": "group",
"show_in_graphql": 1,
"graphql_field_name": "myFieldWithGroup"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
]
}
]
);
});

Querying the Group field