Here’s how you can find all users that have a certain metadata value for a specific meta_key.
First set an argument array with the specific meta_key and value and operator.
In my case, I wanted all users with a member_number equal to ‘xxxxxxx’. The meta_key is ‘member_number’and the meta_value is ‘xxxxxxx’. If both of those values are true for a user, I want the user object returned.
//
$args = array(
'meta_query' => array(
array(
'key' => 'member_number',
'value' => 'xxxxxxx',
'compare' => '='
)
)
);
$member_arr = get_users($args);
if ($member_arr) {
foreach ($member_arr as $user) {
echo 'User ID ='.$user->ID;
}
} else {
echo 'no users found';
}
//
The output from this will be a list of user ID’s for users who have a meta_value of ‘xxxxxxx’ for the meta_key ‘member_number’. This code can go anywhere php is allowed in WordPress.

Pingback: Add a Certain Meta Data to A Certain User via Get Variables - Cullen Web Services