Contents
Action that runs after a video is successfully imported as WordPress video post.
add_filter( 'vimeotheque\import_success', (int) $post_id, (array) $video, (array|false) $theme_compatibility, (string) $post_type )
Parameters
$post_id
(int) The ID of the post created on import.
$video
(array) The video details retrieved from Vimeo. For complete reference, see the video details reference.
$theme_import
(array) If the video is imported as a post for a compatible WordPress theme, the array will be populated with the theme details, otherwise will have value (bool) false
.
$post_type
(string) The post type created for the imported video.
Usage
/** | |
* @param int $post_id - ID of currently created video post | |
* @param array $video - array containing video details | |
*/ | |
function store_video_duration( $post_id, $video ){ | |
// Store the formatted duration (HH:MM:SS) | |
update_post_meta( $post_id, 'video_duration', $video['_duration'] ); | |
} | |
add_action( 'vimeotheque\import_success', 'store_video_duration', 10, 2 ); |