So I'm using a checkbox field, and I check it's value by using the code below and print things out accordingly. Anyway, if the field's checkboxes don't have any value, meaning all of them are unchecked, I get an error.
Warning: in_array() expects parameter 2 to be array, boolean given in /filepath.php on line 647
<?php if (in_array( 'Subbed', get_field('episode_sdversion'))) { ?>
<a href="<?php echo $episode_permalink; ?>#subbed">Subbed</a>
<?php } else {
echo '--';
} ?>
So basically, what can I do with this code to make it so when all values are unchecked, that would automatically mean that "Subbed" value is also unchecked, so it should simply just show echo '--';
. So how can I make this echo '--';
run when all values are unchecked. So it shouldn't come up with that error?