There is a problem with the “true / false” field. In the admin edit page field always show true(checked) even my database store “false”. But if database store “1” or “0” the field works like a charm.
I’m use headless WordPress import csv file with the code, but WordPress convert “1/0” into “True/False”, I’m use custom code to fix input data.
function my_acf_update_value($value, $post_id, $field)
{
$value = filter_var($value, FILTER_VALIDATE_BOOLEAN) ? 1 : 0;
return $value;
}
add_filter('acf/update_value/name=my_field', 'my_acf_update_value', 10, 3);
In admin edit page use field interface everything is fine.
Maybe it’s a bug ?
environment
WordPress 5.2.2
Advanced Custom Fields 5.8.3
Thank you in advance for your cooperation.
It’s not a bug in ACF. ACF has always stored 1/0 for true false fields. The problem is with what you’re using to import.