tammyhart / Reusable-Custom-WordPress-Meta-Boxes

177 stars 97 forks source link

Warning: in_array() expects parameter 2 to be array, string given in C:\wamp\www\mytheme\wp-content\themes\mytheme\library\inc\metaboxes\meta_box.php on line 113 #29

Closed williamrembert closed 11 years ago

williamrembert commented 11 years ago

Hi,

First of all, thanks for sharing your work, everything is good. I just had this error message for the Post List field

"Warning: in_array() expects parameter 2 to be array, string given in C:\wamp\www\mytheme\wp-content\themes\mytheme\library\inc\metaboxes\meta_box.php on line 113"

The only change made was : $sample_box = new custom_add_meta_box( 'sample_box', 'Sample Box', $fields, array('post','page','portfolio'), true );

But it's also broken if I let the post_type at "page"

pdewouters commented 11 years ago

yes, this just needs an extra check : if(is_array() && in_array...

tammyhart commented 11 years ago

Good catch, @pdewouters. Latest commit has this fix.