php WP Foto Vote - 上传Youtube视频时触发,Video addon解析视频缩略图

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WP Foto Vote - 上传Youtube视频时触发,Video addon解析视频缩略图相关的知识,希望对你有一定的参考价值。

<?php

## Trigger when Youtube Video is uploaded and Video thumbnail parsed by Video addon

add_action("wp_youtube_upload_attachment_thumbnail_saved", function($att){

	// Update competitor Thumbnail& change type to Video
	$competitor = ModelCompetitors::q()->where('image_id', $att->get_post_id() )->findRow();

	if ( !$competitor ) {
		fv_log("wp_youtube_upload_attachment_thumbnail_saved >> no competitor!");
		return;
	}

	if ( $competitor->storage != 'youtube' ) {
		fv_log("wp_youtube_upload_attachment_thumbnail_saved >> storage is not youyube!");
		return;
	}

	$postdata = array(
		'post_title' => 'New Video from ' . $competitor->name,
		'post_content' => '<iframe src="' . $competitor->url . '" width="800" height="600"></iframe>',
		'post_author' => $competitor->user_id,	// Admin ?
		'post_type' => 'post',  ## YOUR POST TYPE HERE ££
		'post_status' => 'publish',
	);

	$post_id = wp_insert_post( $postdata );

	if ( ! is_wp_error($post_id) ) {
		add_post_meta( $post_id, '_thumbnail_id', $att->get_post_id() );
	}

	

}, 99, 1);

以上是关于php WP Foto Vote - 上传Youtube视频时触发,Video addon解析视频缩略图的主要内容,如果未能解决你的问题,请参考以下文章

php WP Foto Vote - 用户照片谎言 - 更改拇指大小

php WP FOTO VOTE ::添加额外的工具栏链接

php wp base 64上传文件

在 Codeigniter 中上传多个文件并更改名称文件

上传 Wordpress 图片:错误 Permission denied in ....wp-admin/includes/file.php

我的虚拟主机上传了wordpress后无法自动创建wp-config.php这个文件,