Plugin filters / cbc allow video import

Description

Using this filter you can prevent a certain video from being imported into a WordPress post.

Parameters

$allow
(boolean)(required) Allow video to be imported (true) or prevent the post creation (false).

Default:true
$video
(array)(optional) Array containing the video details retrieved from YouTube.

Default:array
$post_type
(string)(optional) The post type that will be created for this video.

Default:None
$theme_import
(array)(optional) If importing is done for compatible WP theme, the array will contain the theme details.

Default:None

Examples

Prevent videos shorter than 10 minutes to be imported.

/**
 * Prevent videos shorter than 10 minutes to be imported
 * 
 * @param boolean $allow
 * @param array $video
 * @param string $post_type
 * @param array $theme_import
 * @return boolean
 */
function prevent_video_import( $allow, $video, $post_type, $theme_import ){
	$ten_minutes = 10 * MINUTE_IN_SECONDS;
	$allow = ( $ten_minutes > $video['duration'] );	
	return $allow;
}
add_filter( 'cbc_allow_video_import', 'prevent_video_import', 10, 4 );

Related