[Plugin: Latest Custom Post Type Updates] Bug – in_array() datatype conflict
-
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/site/public_html/rsl.site.ca/wp-content/plugins/latest-custom-post-type-updates/options.php on line 190 /> PostsLocal function appears as so:
<p> <!-- POST TYPE FOR WIDGET --> <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Types:'); ?></label> <?php // Filter out post types that are internal such as attachments or internal theme post types used for options. $args = array( 'show_ui' => true, ); $post_types = get_post_types($args, 'objects'); foreach($post_types as $post_type=>$vars) { echo '<br /><input type="checkbox" name="'.$this->get_field_name('post_type').'[]" value="'.$post_type.'"'; if( in_array($post_type, $instance['post_type'] ) ) echo 'checked="checked"'; echo ' /> '.$vars->labels->name.''; } ?> </select> </p>Suggested fix: Check is_array() before executing in_array().
<p> <!-- POST TYPE FOR WIDGET --> <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Post Types:'); ?></label> <?php // Filter out post types that are internal such as attachments or internal theme post types used for options. $args = array( 'show_ui' => true, ); $post_types = get_post_types($args, 'objects'); foreach($post_types as $post_type=>$vars) { echo '<br /><input type="checkbox" name="'.$this->get_field_name('post_type').'[]" value="'.$post_type.'"'; if( is_array( $instance['post_type'])){ if( in_array($post_type, $instance['post_type'] ) ) echo 'checked="checked"'; } echo ' /> '.$vars->labels->name.''; } ?> </select> </p>http://ww.wp.xz.cn/extend/plugins/latest-custom-post-type-updates/
The topic ‘[Plugin: Latest Custom Post Type Updates] Bug – in_array() datatype conflict’ is closed to new replies.