web-dev-qa-db-ja.com

get_users meta_query

Get_users()でmeta_queriesが正しく機能しません。私の人生のために私が間違っていることを理解することはできません。

    $args = array(
        'meta_query'   =>

            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 );
1
jamessy

meta_queryパラメータは配列の配列です。

    $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 );
3
anu