Description

By default, the plugin will skip importing a video if the video post already exists. In this way you won’t end up with duplicate posts if, for example, you import 2 different albums that have several videos in common.
Filter cvm_existing_video_posts_taxonomies allows you to assign an already existing video post to any of the extra categories/tags set when importing videos.

Parameters

$posts
(array/WP_Post)(required) Contains the post or posts that already exist and were skipped by the plugin.

Default:array/WP_Post
$taxonomy
(string)(optional) The taxonomy name used as category for the posts created by the plugin.

Default:None
$category
(array/string)(optional) The categories that have taxonomy $taxonomy that will be assigned to the $posts.

Default:None
$tag_taxonomy
(string)(optional) The taxonomy name used for tags.

Default:None
$tags
(array/string)(optional) The actual taxonomies that will be assigned to the post.

Default:None

Examples

Assign the extra taxonomies for any posts already existing.

/**
 * Add the extra taxonomies for videos already imported 
 * from another import. Won't create duplicates.
 * @param array $posts - array of WP_POST objects
 * @param string $taxonomy - taxonomy used as category
 * @param string $category - category name
 * @param string $tag_taxonomy - taxonomy name used as tag
 * @param string $tags - the tags 
 */
function add_extra_taxonomies( $posts, $taxonomy, $category, $tag_taxonomy, $tags ){
	
	if( !is_array( $posts ) ){
		$posts = array( $posts );
	}
		
	foreach( $posts as $post ){		
		if( $category ){
			wp_set_post_terms( $post->ID, $category, $taxonomy, true );
		}
		if( $tags ){
			wp_set_post_terms( $post->ID, $tags, $tag_taxonomy, true );
		}
	}
}
add_action( 'cvm_existing_video_posts_taxonomies', 'add_extra_taxonomies', 10, 5 );