Home › Forums › Bug Reports › ACF – PHP 7.4 ERROR › Reply To: ACF – PHP 7.4 ERROR
@hube2, thanks for your quick reply, I now see what’s going on. Two things:
Firstly, the issue has obviously always been there, but only PHP 7.4 shows a notice.
Secondly, maybe to help others:
I have set up a field as yes/no toggle with ‘no’ as default value. Now when I create a new post and ‘no’ is already the right value for this field, then it won’t be created in the database on saving the post—as long as you don’t set it to ‘yes’, update the post, and set it back to ‘no’ again.
So my solution here is to check if the field exists at all, and if not, assume it is ‘no’:
$field_object = get_field_object( 'p_props_' . $grp . '_' . $v );
if ( !$field_object ) :
// Field doesn’t exist --> false
// ...
else :
if ( $field_object['type'] == 'true_false' ) :
Again, thank you very much!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.