I am working on a plugin for generating podcast feeds, and I'm trying to figure out if it is possible to use WP_Query to pull only posts from a specified category that have audio attachments. I know I can do this in a custom query, for example:
$podeps = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS $wpdb->posts.* FROM $wpdb->posts,wp_term_relationships WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND $wpdb->term_relationships.term_taxonomy_id IN ($catid) AND $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.ID IN ( SELECT DISTINCT post_parent FROM $wpdb->posts WHERE post_parent > 0 AND post_type = 'attachment' AND post_mime_type = 'audio/mpeg' ) GROUP BY $wpdb->posts.ID ORDER BY $wpdb->posts.post_date DESC LIMIT 50", OBJECT );
But is there a way to do this using WP_Query? If possible, I would like to refrain from having to write the query directly, so as to ensure broadest compatiblity. Thanks!