Ooyala::get_attachment_id PHP Method

get_attachment_id() public method

Look up an attachment ID based on a given Ooyala thumbnail URL
public get_attachment_id ( string $url ) : integer
$url string
return integer
    function get_attachment_id($url)
    {
        // Though this is a query on postmeta, it's only invoked by administrative
        // users on a relatively infrequent basis
        $query = new WP_Query(array('post_type' => 'attachment', 'meta_query' => array(array('key' => 'ooyala_source', 'value' => $url)), 'post_status' => 'any', 'fields' => 'ids', 'posts_per_page' => 1));
        return $query->posts ? $query->posts[0] : 0;
    }