@CynthiaLara
I suppose that you are using a container of WP_USER_QUERY::__construct
in the form or WP_USER_QUERY
or get_users
or something to that effect.
You can use 'meta_key' => '<YOUR_DESIGNATION_META_KEY>','orderby' => 'meta_value_num,
to get results sorted by your meta key’s value.
If you have used a texted based value in for this meta_key, please consider using a numeric value based system. eg.
- 0 = ‘Director’
- 1 = ‘CTO’
and so on as this will allow you to achieve what you want with ease and you can event have the designation array globally defined, store the index as user meta based on selected designation and show the designation based on the stored meta value.
Good luck!!
Update with code sample
$args = array(
'meta_key' => 'member_role',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
$results = get_users( $args );
and then you can iterate with your foreach
loop.
And do not that the option values for the select drop down must be like 0,1,2,3 etc.