I basically do this now:
$users = get_users();
sort($users);
foreach ( $users as $user ) {
echo '<option>' . $user->companyname . '</option>';
}
Except the sort() function will sort by the ID. How can I change it to sort by my custom field companyname?
get_users
?