Select
ACF
Last Upated: Friday, Feb 2, 2024
select
The Select field type is native to ACF (free) and provides users with a dropdown list with selectable choices.
Resolve Type
Fields of the "select" field type resolve to a "List of String" in the GraphQL Schema, even if the choice values are numbers or boolean values, and even if only one value is selected.
Field Settings
Field Configuration
<?phpadd_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 select", "show_in_graphql": 1, "graphql_field_name": "myFieldGroupWithSelect", "map_graphql_types_from_location_rules": 0, "graphql_types": [ "Page" ], "fields": [ { "key": "my_field_", "label": "My Field", "name": "my_field", "type": "select", "show_in_graphql": 1, "graphql_field_name": "myFieldWithSelect" } ], "location": [ [ { "param": "post_type", "operator": "==", "value": "page" } ] ] } ] );});