首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >第二个论点的数据类型错误吗?

第二个论点的数据类型错误吗?
EN

Stack Overflow用户
提问于 2011-05-12 21:36:34
回答 1查看 1.7K关注 0票数 2

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

/home/healt134/public_html/wp-content/plugins/video-thumbnails/video-thumbnails.php中的

警告: in_array() function.in-array:第二个参数在第402行中的数据类型错误

警告:无法修改标题信息-已由

(输出从/home/healt134/public_html/wp-content/plugins/video-thumbnails/video-thumbnails.php:402)开始,在第897行的/home/healt134/public_html/wp-includes/pluggable.php中开始

我看了402中的代码(用星号标记),但我没有看到问题或多余的空白。有人知道我能做些什么来阻止这个错误吗?

代码语言:javascript
复制
    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;
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-05-12 22:11:24

我想你在那里少了几行,再往下4行。我猜$video_thumbnails_post_types不是数组。

if语句的第二个条件来看,$video_thumbnails_post_types看起来可能是标量(字符串、int等)。如果你能做到这一点,修改代码

代码语言:javascript
复制
if (in_array($post_type, (array) $video_thumbnails_post_types)
    || $post_type == $video_thumbnails_post_types)
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5984770

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档