The WP_User_Query
allows meta_query
searches exactly like the other WP_*_Query
classes. Example here:
global $wpdb;
$author_search = new WP_User_Query( array(
'role' => 'subscriber',
'fields' => 'all_with_meta',
// if it's a digit/int/float, use 'meta_value_num'
'orderby' => 'meta_value',
'order' => 'ASC',
// you could try -1 as well.
'nuber' => 99999999,
'meta_query' => array(
'key' => 'my_userpoints',
// only needed if you got a specific value you search for
// 'value' => '',
// only needed if you got a specific value you search for
// and want to compare against it. For e.g. '>', '<', etc. See Codex.
// 'compare' => '',
'type' => 'CHAR', // this is the default, use INT if you got an int/float value
),
) );
$author_list = $author_search->get_results();
$author_count = $wpdb->num_rows;