You’re setting two different meta_key fields to check on: 'course'
, and 'clinic'
. Try doing it with just one like so:
$args = array(
'orderby' => 'display_name',
'fields' => 'all',
'search' => $search,
'meta_query' => array(
array(
'key' => 'clinic',
'value' => $search,
'compare' => 'LIKE'
)
)
);
What your current query is doing is returning users who match the $search
parameter on the basic user columns AND the meta key “clinic”. Is this your intention?
Update 3/24/16:
Try this:
$args = array(
'orderby' => 'display_name',
'fields' => 'all',
'search' => $search,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'course',
'value' => $search,
'compare' => 'LIKE'
),
array(
'key' => 'clinic',
'value' => $search,
'compare' => 'LIKE'
)
)
);