hlashbrooke / WordPress-Plugin-Template

A robust code template for creating a standards-compliant WordPress plugin.
https://hughlashbrooke.com/
GNU General Public License v2.0
1.03k stars 329 forks source link

Unselecting all options of checkbox_multi generates error. #30

Closed andrewlaskey closed 8 years ago

andrewlaskey commented 9 years ago
Warning: in_array() expects parameter 2 to be array, string given in "...-admin-api.php" on line 112

It looks like when you unselect all the options in a checkbox_multi field, it is saved as an empty string, rather than an empty array. Trying to loop through the option as an array, or in this case use the in_array() test, Wordpress generates an error.

senlin commented 8 years ago

I am experiencing the exact same issue. I believe it is not an error, but a warning, nevertheless it shouldn't be there :)