title: WordPress User Query by ACF Custom Fields?
body: <p>I asked a question earlier and someone was very nice to help out and point me in the right direction, but now i'm stuck again and hoping someone can help! :)</p>
  <p>So, I have a search form on a wordpress site that connects to ACF. It takes ACF fields and then maps them to checkboxes that are assigned values that I want to then take and query the WP_USER database and retrieve users who match the query. So, for example, a user profile will look like:</p>
  <p>User 1
  Medium: Paint, Wood, Jewelry
  Location: Paris</p>
  <p>User 2
  Medium: Wood, Jewelry
  Location: London</p>
  <p>The issue i'm running into is getting the WP_USER_QUERY to do a few things:</p>
  <ol>
  <li>Only look in the ACF field for a match. Right now, my query looks throughout the whole entire profile including the ACF field, but I only want results that match the ACF field.</li>
  <li>Be able to search by a array of options (i.e. search by Wood and Paint in Medium and be returned User 1 &amp; User 2)</li>
  </ol>
  <p>I'm having odd results. Currently, I have my query set up like this:</p>
  <pre><code>$user_query = new WP_USER_QUERY($args = array(
              'role' =&gt; 'artist',
              'orderby' =&gt; 'meta_value',
              'order' =&gt; 'ASC',
              'meta_query' =&gt; array(
                  'relation' =&gt; 'AND',
                  array(
                      'key' =&gt; 'artist_medium',
                      'value' =&gt; array($medium),
                      'compare' =&gt; 'LIKE',
                  ),
                  array(
                      'key' =&gt; 'studio_region_location',
                      'value' =&gt; array($location),
                      'compare' =&gt; 'LIKE',
                  )
              )
          ));
  
  </code></pre>
  <p>Now a print_r of $medium and $location will look like this:</p>
  <pre><code>Wood, Paint
  Paris, London
  
  </code></pre>
  <p>But the WP_USER_QUERY will return just the entire list of users again instead of actually filtering it.</p>
  <p>Being curious, I tried to change the logic to use it without the variables like so:</p>
  <pre><code> $user_query = new WP_USER_QUERY($args = array(
              'role' =&gt; 'artist',
              'orderby' =&gt; 'meta_value',
              'order' =&gt; 'ASC',
              'meta_query' =&gt; array(
                  'relation' =&gt; 'AND',
                  array(
                      'key' =&gt; 'artist_medium',
                      'value' =&gt; array('Jewelry', 'Mixed Media'),
                      'compare' =&gt; 'LIKE',
                  )
              )
          ));
  </code></pre>
  <p>But again, I just get the list of every user again. If I change the 'compare' to anything except 'LIKE', I get no results. <em>However</em> if I change the query to be like the following:</p>
  <pre><code>
  $user_query = new WP_USER_QUERY($args = array(
              'role' =&gt; 'artist',
              'orderby' =&gt; 'meta_value',
              'order' =&gt; 'ASC',
              'meta_query' =&gt; array(
                  array(
                      'key' =&gt; 'artist_medium',
                      'value' =&gt; 'Wood',
                      'compare' =&gt; 'LIKE',
                  )
              )
          ));
  </code></pre>
  <p>I can atleast get this to work correctly...so i'm at a total lost. :(. THe other very kind user said to build a straight up SQL type of query which I don't oppose to do, just would perfer to use the WP_USER_QUERY way.</p>
  <p>Thanks so much!</p>