2

昨日、ワードプレスをアップグレードした後、このエラーが発生しました。それは私のプラグインの1つを指しています:

警告:in_array()[function.in-array]:402行目の/home/healt134/public_html/wp-content/plugins/video-thumbnails/video-thumbnails.phpの2番目の引数のデータ型が間違っています

Warning: Cannot modify header information - headers already sent by

(出力は/home/healt134/public_html/wp-content/plugins/video-thumbnails/video-thumbnails.php:402で開始)/home/healt134/public_html/wp-includes/pluggable.phpの897行目

402(アスタリスクでマークされている)のコードを見ましたが、問題や余分な空白は見られません。このエラーを止めるために私が何ができるか知っている人はいますか?

    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;
        }
    }
}
4

1 に答える 1

3

数行ずれていると思います。4 行下げてみてください。私の推測で$video_thumbnails_post_typesは、配列ではありません。

そのステートメントの 2 番目の条件から、スカラー (string、int など) のifように見えます。$video_thumbnails_post_typesやる気がある場合は、コードを次のように変更します

if (in_array($post_type, (array) $video_thumbnails_post_types)
    || $post_type == $video_thumbnails_post_types)
于 2011-05-12T22:11:24.787 に答える