Support

Account

Home Forums General Issues Wrong datatype for second argument

Helping

Wrong datatype for second argument

  • Hi,

    I have a Checkbox field and options in it. When none of the options are selected in the checkbox, it turns this error and the value as well:

    Warning: in_array() [function.in-array]: Wrong datatype for second argument in/home3/avisg/public_html/.../wp-content/themes/allcpecialed/single-listing.php on line 346
    ☐ Difficult to Grasp 

    But if i select at least one option in the checkbox in the post edit screen, it works perfectly fine. Below the code i am using to get the value from the checkbox, can you please help me to fix this issue?

      if( in_array( 'Difficult to Grasp', get_field('cons') ) )
    	{
    	    echo "☑ Difficult to Grasp";
    	}
    	else {
    	    echo "☐ Difficult to Grasp";
    	}

    Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Wrong datatype for second argument’ is closed to new replies.