您可以使用post_thumbnail_html
筛选器以编程方式将帖子缩略图设置为外部URL。
然后,您可以在post writing屏幕元框的自定义字段中设置图像URL(在本例中,元键为thumbnail_url
):
add_filter(\'post_thumbnail_html\', \'custom_thumbnail_tag_filter\', 10, 3);
function custom_thumbnail_tag_filter($html, $postid, $thumbnailid) {
if (!$thumbnailid) {
$src = get_post_meta($postid, \'thumbnail_url\', true);
if ($src) {$html = "<img src=\'" . $src . "\'>";}
}
return $html;
}