WordPress: Wrong datatype for second argument?

I got this error yesterday after upgrading wordpress. It’s pointing to one of my plugins:

Warning: in_array()
[function.in-array]: Wrong datatype
for second argument in
/home/healt134/public_html/wp-content/plugins/video-thumbnails/video-thumbnails.php
on line 402

Read More
Warning: Cannot modify header information - headers already sent by

(output started at
/home/healt134/public_html/wp-content/plugins/video-thumbnails/video-thumbnails.php:402)
in
/home/healt134/public_html/wp-includes/pluggable.php
on line 897

I looked at the code in 402 (marked with asterisks) but I don’t see a problem or excess white-space there. Anyone know what I might be able to do to stop this error?

    function save_video_thumbnail( $post ){
        $post_type = get_post_type( $post->ID );
        $video_thumbnails_post_types = get_option('video_thumbnails_post_types');
***     if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {
            return null;
        } else {
            // Check that Video Thumbnails are enabled for current post type
            if (in_array($post_type, $video_thumbnails_post_types) OR $post_type == $video_thumbnails_post_types) {
                get_video_thumbnail($post->ID);
        } else {
            return null;
        }
    }
}

Related posts

Leave a Reply

1 comment

  1. I think you’re off by a couple of lines there, try 4 lines lower. My guess is $video_thumbnails_post_types is not an array.

    From the second condition in that if statement, it looks like $video_thumbnails_post_types may be a scalar (string, int, etc). If you’re up to it, modify the code to be

    if (in_array($post_type, (array) $video_thumbnails_post_types)
        || $post_type == $video_thumbnails_post_types)