diff --git a/ts.php b/ts.php index eeed874..6b0fc44 100644 --- a/ts.php +++ b/ts.php @@ -189,7 +189,7 @@ class AcareOffice{ 'users' => [], ); //search all users that are staff - $staffq = new \WP_User_Query(array('role'=>'staff')); + $staffq = new \WP_User_Query(array('role'=>'staff','meta_key'=>'first_name', 'orderby'=>'meta_value', order=>'ASC')); $staff = $staffq->get_results(); if (! empty($staff)){ $response['status'] = 'success'; @@ -220,7 +220,7 @@ class AcareOffice{ 'users' => [], ); //search all users that are staff - $clientq = new \WP_User_Query(array('role'=>'client')); + $clientq = new \WP_User_Query(array('role'=>'client', 'meta_key'=>'first_name', 'orderby'=>'meta_value', order=>'ASC')); $client = $clientq->get_results(); if (! empty($client)){ $response['status'] = 'success'; @@ -246,7 +246,7 @@ class AcareOffice{ private function get_people_by_role($role){ //search all users that are staff - $staffq = new \WP_User_Query(array('role'=>$role)); + $staffq = new \WP_User_Query(array('role'=>$role, 'meta_key'=>'first_name', 'orderby'=>'meta_value', order=>'ASC')); $staff = $staffq->get_results(); return $staff; }