wordpress缩略图不显示后台设置的特色图片问题排查和修改

 首先排查到获取不到后台设置的特色图片是因为file_get_contents一直返回false,经排查是因为apache没有配置证书,修改如下:

 $sticky, 'caller_get_posts' => 1) );//, "category__in" => array(3909,36,22,3915)
    $i = 0;
    while (have_posts()) : the_post();
        $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),full)[0];
        $opts = [
            "ssl" => [
                 "verify_peer"=>false,
                 "verify_peer_name"=>false,
             ],
             "http" => [
                  "method"=>"GET",
                  "timeout"=>1,
              ]
        ];
        //创建数据流上下文
        $context = stream_context_create($opts);
        if(!$img || !file_get_contents($img,0,$context,0,1)){
            $img = catch_that_image();
        }
    }

?>

 

你可能感兴趣的:(wordpress)