且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

名字以字母“Z”开头获取用户

更新时间:2023-01-30 08:04:46

使用大于或等于运算符 meta_value 返回结果,其中 first_name 开头于> =

Use the "greater than or equals" operator >= on the meta_value to return results where first_name starts with "V" through "Z", inclusive.

$args = array(
    'role' => 'subscriber',
    'meta_query' => array(
        array(
            'key' => 'first_name',
            'value' => 'V',
            'compare' => '>='
        )
    )
);
$users = get_users( $args );