title: WP_Query on different post_types with additional conditions per post_type
body: <p>in short I have the following situation: products that are posted by the users which have a custom post type. Call them "ads". Ads have a 1-1 link to WooCommerce Products.
  Next to that I have WooCommerce Products that are Vendor Item (they are added by a multiple vendor plugin) and distinguish from other post_type products with their meta_key "_vendor_product" set to 1.</p>
  
  <p>So far I made 2 queries and added them:</p>
  
  <pre><code>$ads = new WP_Query(
      array(
          'post_type' =&gt; 'ads',
          'paged' =&gt; $paged,
          'post_status' =&gt; 'publish',
          'meta_query' =&gt; array(
              array(
                  'key' =&gt; 'product_id',
                  'value' =&gt; $product_ids,
                  'compare' =&gt; 'IN'
              )
          )
      )
  );
  $shop_items = new WP_Query(
      array(
          'post_type' =&gt; 'product',
          'paged' =&gt; $paged,
          'post__in' =&gt; $product_ids,
          'meta_query' =&gt; array(
              array(
                  'key' =&gt; '_vendor_product',
                  'value' =&gt; 1,
                  'compare' =&gt; '='
              )
          )
      )
   );
  }
  
  // Include shop items in the stream of products
  $wp_query = new WP_Query(array('paged' =&gt; $paged));
  $wp_query-&gt;posts = array_merge( $ads-&gt;posts, $shop_items-&gt;posts );
  $wp_query-&gt;post_count = $ads-&gt;post_count + $shop_items-&gt;post_count;
  </code></pre>
  
  <p>But I need them both in one WP_Query, as otherwise somehwere my actions/filters/pagination seem to break.
  I know I can query different post_types by <code>'post_type' =&gt; array( 'ads', 'product' )</code> but the condition of <code>_vendor_product = 1</code> only applies to the items of post_type <code>product</code> and not to <code>ads</code>. </p>
  
  <p>What I need is basically</p>
  
  <pre><code>SELECT * FROM wp_posts, wp_postmeta 
  WHERE (post_type = 'ads') 
  OR 
  (post_type = 'product' AND meta_key = '_vendor_product' AND meta_value = 1) 
  AND 
  wp_posts.ID = wp_postmeta.post_id
  </code></pre>
  
  <p>Is it possible to achieve this within the boundaries of WP_Query? </p>