gpt4 book ai didi

php - Wordpress:第二个参数的数据类型错误?

转载 作者:行者123 更新时间:2023-12-04 06:26:34 27 4
gpt4 key购买 nike

昨天升级wordpress后我收到了这个错误。它指向我的插件之一:

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

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



我查看了 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 行。我的猜测是 $video_thumbnails_post_types不是数组。

来自 if 中的第二个条件声明,看起来像 $video_thumbnails_post_types可以是标量(字符串、整数等)。如果您愿意,请将代码修改为

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

关于php - Wordpress:第二个参数的数据类型错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5984770/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com