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

Checkbox

ACF
Last Upated: Thursday, Feb 1, 2024

checkbox

The Checkbox field type is native to ACF (free) and provides users with the option to select a choice from a group of buttons.

Resolve Type

Fields of the "checkbox" field type resolve to a "List of String" in the GraphQL Schema, even if the choices are numbers or boolean values, and even if only one value is selected.

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

Querying the Checkbox Field