get_users meta_query

meta_query parameter is an array of arrays,

    $args = array(
        'meta_query'=>

         array(

            array(

                'relation' => 'AND',

            array(
                'key' => 'minbeds',
                'value' => $rooms,
                'compare' => "<=",
                'type' => 'numeric'
            ),

            array(
                'key' => 'maxbeds',
                'value' =>  $rooms,
                'compare' => ">=",
                'type' => 'numeric'
            ),

           array(
                'key' => 'minprice',
                'value' => $price,
                'compare' => "<=",
                'type' => 'numeric'
            ),

            array(
                'key' => 'maxprice',
                'value' => $price,
                'compare' => ">=",
                'type' => 'numeric'
            )
          )
       )
    );

    $users = get_users( $args );

Leave a Comment