get_users с meta_query
14 янв. 2013 г., 11:27:44
Просмотры: 21K
Голосов: 4
Я не могу правильно настроить работу meta_queries в get_users(). Как ни пытаюсь, не могу понять, что делаю неправильно.
$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 );

jamessy
65
Все ответы на вопрос
1
1
Параметр 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 );

anu
9.58K
14 янв. 2013 г. 11:38:12
Похожие вопросы
3
ответов