The value passed to reset()
is passed by reference, which means technically it modifies the original variable that’s passed to it. For this to work you need to pass a variable, not a function that returns a value.
reset() rewinds array’s internal pointer to the first element and
returns the value of the first array element.
All you need to do is assign the returned value if get_users()
to a variable and then use reset()
on that:
$users = get_users( array(
'meta_query' => array(
'relation' => 'AND',
array(
'key'=>'first_name',
'value' => $pieces[0],
'compare' => '='
),
array(
'key' => 'last_name',
'value' => $pieces[1],
'compare' => '='
)
),
'number' => 1,
'count_total' => false
) );
$user = reset( $users );