WP_Query with two post types, but requiring category on only one of those post types

Question

I have a simple WP_Query:

$loop = new WP_Query(array( 
      'post_type' => array('image', 'video'), 
      'category_name' => $cat, 
      'meta_key'=>'total_votes', 
      'orderby'=>'date meta_value_num'
));

How can I alter this so that it return only videos with the tag editor-pick while still returning all images regardless of tags?

I’m looking for a filter to add onto the MySQL query so that order and pagination remain intact.

0
jetlej 5 months 0 Answers 55 views 0

Leave an answer