Support

Account

Home Forums Front-end Issues Checkbox conditional error Reply To: Checkbox conditional error

  • Hi @dvize

    If no checkbox value is selected, the get_field will return false. The in_array function expects an array, not false. This is why you see the error.

    You need to write more bullet proof code like this:

    
    $tours = get_field('tours');
    <?php if ( !empty($tours) || !in_array( 'START wages-through-ages', get_field('tours') ) ) { ?>
    
    my stuff
    
    <?php } ?>