First and last name search using WP_User_Query
<p>I am trying to develop a directory search.  The following works fine for last name search with like.  But, I need last and first name to search together.  How can I make that happen:</p>

<pre><code>function dispDirectory()
{
  global $user_ID;

  // Disallow directory if there is a messaging administrator and this person is not it.
  if ($this-&gt;admin_user_id &amp;&amp; $this-&gt;admin_user_id != $user_ID) {
    return '';
  }

    $directory = "&lt;form name='form' method='post'&gt;&lt;label for='clientname'&gt;Client Name: &lt;/label&gt;
    &lt;input name='clientname' id='clientname' type='text' style='width: 181px;'
    value=''/&gt;&lt;input type='submit'&gt;&lt;/form&gt;";

    $clientname= $_POST["clientname"];

    $search_string = $clientname;

    $args  = array(
        'meta_key' =&gt; 'last_name',
        'meta_compare' =&gt; 'like',
        'meta_value' =&gt; $search_string,
    );

    $wp_user_query = new WP_User_Query($args);
    $wp_user_query-&gt;query_orderby = str_replace( 'user_login', 'wp_usermeta.meta_value', $wp_user_query-&gt;query_orderby );
    $wp_user_query-&gt;query();

    $users = $wp_user_query-&gt;get_results();


  foreach($users as $u)
  {
    $firstName = get_user_meta($u-&gt;ID, 'first_name', true);
    $lastName = get_user_meta($u-&gt;ID, 'last_name', true);         

    $directory .= '&lt;p&gt;&lt;strong&gt;'.$lastName.', '.$firstName.'&lt;/strong&gt; - &lt;a href="'.$this-&gt;actionURL.'newmessage&amp;to='.$u-&gt;ID.'"&gt;'.__('Send Message', 'cartpaujpm').'&lt;/a&gt;&lt;/p&gt;';
  }
  return $directory;
}
</code></pre>