title: meta_query, how to search using both relation OR & AND?
body: <p>Resolved: See answer below.</p>
  
  <hr>
  
  <p>I have a custom post type called <em>BOOKS</em>. It has several custom fields, named: <code>TITLE</code>, <code>AUTHOR</code>, <code>GENRE</code>, <code>RATING</code>. How do I fix my <code>meta_query</code> code below so that only <em>books</em> that have the search word in the custom fields: <code>title</code>, <code>author</code>, <code>genre</code> <strong>WITH EXACTLY</strong> the <code>rating</code> specified in my search form, gets displayed in the results?</p>
  
  <p>I have made a custom search form; a text area that will search through the <code>title</code>, <code>author</code> and <code>genre</code>; and a dropdown that will search for the <code>rating</code>. The <code>meta_query</code> I made below only searches through the <code>title</code>, <code>author</code>, and <code>genre</code>. But I am now stumped in how to add the code for the <code>rating</code>.</p>
  
  <p>This is how I visually imagined it with meta_query relation: 
  (title OR author OR genre) AND rating</p>
  
  <pre><code>$args = array(
          'relation' =&gt; 'OR',
            array(
               'key' =&gt; 'title',
               'value' =&gt; $searchvalue,
               'compare' =&gt; 'LIKE'
            );
            array(
               'key' =&gt; 'author',
               'value' =&gt; $searchvalue,
               'compare' =&gt; 'LIKE'
            );
            array(
               'key' =&gt; 'genre',
               'value' =&gt; $searchvalue,
               'compare' =&gt; 'LIKE'
            );
  ), 
          array(
          'relation' =&gt; 'AND', 
            array(
               'key' =&gt; 'rating',
               'value' =&gt; $ratingvalue,
               'compare' =&gt; '=',
               'type' =&gt; 'NUMERIC'
            ));
  </code></pre>
  
  <p>I would extremely appreciate your help and advice.</p>