Answers:
不是本地的。您必须编写一些代码才能实现它-有一个不错的pastebin函数,它提供了完成此任务所需的代码。
编辑(12/19/2011):
是的,这是您可以通过编程方式执行此操作的方法。将以下两个函数添加到您的functions.php文件中,您应该会很好。该代码已被注释以解释发生了什么,但是这里有一个很高的期望值:
你必须...
该代码将...
请注意,如果您的帖子中包含多个URL,则需要修改代码以正确找到YouTube URL。这可以通过遍历$attachments集合并嗅探出看起来像YouTube URL的URL来完成。
function set_youtube_as_featured_image($post_id) {  
    // only want to do this if the post has no thumbnail
    if(!has_post_thumbnail($post_id)) { 
        // find the youtube url
        $post_array = get_post($post_id, ARRAY_A);
        $content = $post_array['post_content'];
        $youtube_id = get_youtube_id($content);
        // build the thumbnail string
        $youtube_thumb_url = 'http://img.youtube.com/vi/' . $youtube_id . '/0.jpg';
        // next, download the URL of the youtube image
        media_sideload_image($youtube_thumb_url, $post_id, 'Sample youtube image.');
        // find the most recent attachment for the given post
        $attachments = get_posts(
            array(
                'post_type' => 'attachment',
                'numberposts' => 1,
                'order' => 'ASC',
                'post_parent' => $post_id
            )
        );
        $attachment = $attachments[0];
        // and set it as the post thumbnail
        set_post_thumbnail( $post_id, $attachment->ID );
    } // end if
} // set_youtube_as_featured_image
add_action('save_post', 'set_youtube_as_featured_image');
function get_youtube_id($content) {
    // find the youtube-based URL in the post
    $urls = array();
    preg_match_all('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $content, $urls);
    $youtube_url = $urls[0][0];
    // next, locate the youtube video id
    $youtube_id = '';
    if(strlen(trim($youtube_url)) > 0) {
        parse_str( parse_url( $youtube_url, PHP_URL_QUERY ) );
        $youtube_id = $v;
    } // end if
    return $youtube_id; 
} // end get_youtube_id需要注意的一件事是,这假设您的帖子没有帖子缩略图,并且一旦设置了帖子缩略图就不会触发。
其次,如果您删除帖子缩略图,然后使用媒体上传器将图像附加到帖子,则将使用最新图像。
get_youtube_id,如果您将jetpack与上述代码一起使用,则500个服务器将使您的应用程序出错。如果您重命名功能,它会工作都OK