I have to get all the users whose first name starts with the letter "Z". I get the user information by using the get_users() function. How can i use the argument query to get the users whose first name letter starts with "Z"?
I used the function below that show me the names that starts with "V", "W", "X", "Y", but not "Z"
$args = array(
'role' => 'subscriber',
'meta_query' => array(
array(
'key' => 'first_name',
'value' => array( 'V', 'Z'),
'compare' => 'BETWEEN'
)
)
);
$users= get_users($args);
Use the "greater than or equals" operator
>=
on themeta_value
to return results wherefirst_name
starts with "V" through "Z", inclusive.Thats meta query works fine with WP_User_Query in latest WP: