video_get_post_by_guid

Using a GUID, find a post.

Description

(WP_Post) video_get_post_by_guid( (string) $guid ); 

Returns (WP_Post)

Parameters (1)

0. $guid (string)
The guid.

Usage

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

Defined (1)

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

/modules/videopress/utility-functions.php  
  1. function video_get_post_by_guid( $guid ) { 
  2. $args = array( 
  3. 'post_type' => 'attachment',  
  4. 'post_mime_type' => 'video/videopress',  
  5. 'post_status' => 'inherit',  
  6. 'meta_query' => array( 
  7. array( 
  8. 'key' => 'videopress_guid',  
  9. 'value' => $guid,  
  10. 'compare' => '=',  
  11. ); 
  12.  
  13. $query = new WP_Query( $args ); 
  14.  
  15. $post = $query->next_post(); 
  16.  
  17. return $post;