这个WP_User_Query
允许meta_query
与其他搜索完全相同WP_*_Query
课程。示例如下:
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;