Consulta meta_query para get_users
14 ene 2013, 11:27:44
Vistas: 21K
Votos: 4
No puedo hacer que meta_queries funcione correctamente en get_users(). Por más que lo intento, no puedo encontrar qué estoy haciendo mal.
$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
Todas las respuestas a la pregunta
1
1
El parámetro meta_query
es un array de 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 );

anu
9.58K
14 ene 2013 11:38:12
Preguntas relacionadas
3
respuestas