If you have billing_phone
as user meta, which is the preferred way, that query would be incorrect. The advantage of utilizing custom user meta and adding a field for billing_phone
would allow you to use get_users()
.
$user = get_users('meta_key' => 'billing_phone', 'meta_value' => $phone_number, 'fields' => 'ID');
The above would give you an array of User IDs that have the matching billing_phone
meta value.