plugins – True/False ACF field returning null by default even if default value is true
Question
I made a true/false ACF field called display_sorting
. It appears that it returns null
no matter if I set the default value or not.
<?php var_dump(get_field('display_sorting'));?>
returns :
[...].php:26:null
If I update the value from the page the field appears, the value will be correctly set to true
or false
.
<?php var_dump(get_field('display_sorting'));?>
will return this time :
[...].php:26:false
or
[...].php:26:true
My problem is that I would like to set the default value to true
so I don’t have to set manually the value on x pages, but currently the default value isn’t properly read.
Am I missing something ?
0
2 months
2022-11-29T03:53:59-05:00
2022-11-29T03:53:59-05:00 0 Answers
0 views
0
Leave an answer