title: Wordpress WP_Query Multiple Queries
body: <p>I'm trying to come up with a way of querying a CPT by a specific author but also if a meta_key has a specific value.</p>
  
  <p>For example, my CPT has an author ID attached to it as well as a 'recipient' custom field. What i need is all posts of this type by this author as well as all posts of this type where 'recipient' = this author.</p>
  
  <p>(Hope I've explained that well enough!)</p>
  
  <p>I'm usually pretty OK with SQL but just having a random brain fart moment and can't figure this one out. Like I said, any help is much appreciated!</p>
  
  <p>== Solved ==</p>
  
  <p>Thanks to @3pepe3 for suggesting the meta_query parameter of WP_Query. Modified my CPT logic slightly and now have a beautifully working system.</p>
  
  <p>The solution was to add a new meta field for each post containing the original sender's user id, then run two meta_queries to retrieve posts where the current user_id matches either the sender or recipient fields, likes so:</p>
  
  <pre><code>$args = array(
      'post_type' =&gt; 'activity',
      'post_status' =&gt; 'publish',
      'orderby' =&gt; 'date',
      'order' =&gt; 'DESC',
      'meta_query' =&gt; array(
          'relation' =&gt; 'OR',
          array(
              'key' =&gt; 'sender',
              'value' =&gt; $user_id,
              'type' =&gt; 'BINARY',
              'compare' =&gt; '='
          ),
          array(
              'key' =&gt; 'recipient',
              'value' =&gt; $user_id,
              'type' =&gt; 'BINARY',
              'compare' =&gt; '='
          )
      )
  );
  
  $query = new WP_Query( $args );
  </code></pre>