Description
Action that runs right after a new video post was successfully created.
Parameters
- $post_id
-
(integer)(optional) The post id of the newly created post
- Default:None
- $video
-
(array)(optional) Video details retrieved from YouTube
- Default:None
- $theme_import
-
(array)(optional) If WP theme is compatible with the plugin and the user chose to import video as theme post the variable will hold the theme details.
- Default:None
- $post_type
-
(string)(optional) The post type of the newly created post.
- Default:None
Examples
Store video likes and views in custom fields.
/** * Add post views and stats in custom fields * @param integer $post * @param array $video * @param array $theme_import * @param string $post_type */ function add_video_stats( $post_id, $video, $theme_import, $post_type ){ // update views update_post_meta( $post_id, 'views', $video['stats']['views'] ); // update likes update_post_meta( $post_id, 'likes', $video['stats']['likes'] ); } add_action( 'cbc_post_insert', 'add_video_stats', 10, 4 );