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

User

ACF
Last Upated: Thursday, Feb 1, 2024

user

The User field is native to ACF (free) and provides users with a select UI to chose one or more users.

Resolve Type

The "user" field type resolves as an "AcfUserConnection" in the GraphQL Schema.

A Connection allows for one or more User nodes to be returned and leaves room for possible future "edge" data to be introduced to the Schema. Edge data is considered relational data between the node with the user field, and the user itself.

Field Settings

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 user",
"show_in_graphql": 1,
"graphql_field_name": "myFieldGroupWithUser",
"map_graphql_types_from_location_rules": 0,
"graphql_types": [
"Page"
],
"fields": [
{
"key": "my_field_",
"label": "My Field",
"name": "my_field",
"type": "user",
"show_in_graphql": 1,
"graphql_field_name": "myFieldWithUser"
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
]
}
]
);
});

Querying the User field

Previous
Url