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

True / False

ACF
Last Upated: Thursday, Feb 1, 2024

true_false

The True/False field is native to ACF (FREE) and allows users to select a value that is either 1 (true) or 0 (false).

Resolve Type

Fields of the true_false type will resolve to Boolean in the GraphQL Schema.

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

Querying the True/False field