videopress_update_meta_data

Update the meta information status for the given video post.

Description

videopress_update_meta_data( (int) $post_id ); 

Parameters (1)

0. $post_id (int)
The post id.

Usage

  1. if ( !function_exists( 'videopress_update_meta_data' ) ) { 
  2. require_once '/modules/videopress/utility-functions.php'; 
  3.  
  4. // The post id. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = videopress_update_meta_data($post_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/videopress/utility-functions.php  
  1. function videopress_update_meta_data( $post_id ) { 
  2.  
  3. $meta = wp_get_attachment_metadata( $post_id ); 
  4.  
  5. // If this has not been processed by VideoPress, we can skip the rest. 
  6. if ( ! $meta || ! isset( $meta['videopress'] ) ) { 
  7. return false; 
  8.  
  9. $info = (object) $meta['videopress']; 
  10.  
  11. $args = array( 
  12. // 'sslverify' => false,  
  13. ); 
  14.  
  15. $result = wp_remote_get( videopress_make_video_get_path( $info->guid ), $args ); 
  16.  
  17. if ( is_wp_error( $result ) ) { 
  18. return false; 
  19.  
  20. $response = json_decode( $result['body'], true ); 
  21.  
  22. // Update the attachment metadata. 
  23. $meta['videopress'] = $response; 
  24.  
  25. wp_update_attachment_metadata( $post_id, $meta ); 
  26.  
  27. return true;