Answer the question
In order to leave comments, you need to log in
WORDPRESS, how to get a post via meta_query with the smallest meta_value?
Good day, I'm bothering with WordPress and, in a word, I'm studying =)
a question arose, I make a request to the database:
$true_args = array(
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'user-rating',
'value' => 'pro'
),
array(
'key' => 'rating',
'value' => array( 100, 200 ),
'type' => 'numeric',
'compare' => 'BETWEEN'
)
)
);
$true_query = new WP_Query( $true_args );
$true_args = array(
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'user-rating',
'value' => 'pro'
),
array(
'key' => 'rating',
'value' => 'САМОЕ МАЛЕНЬКОЕ ЗНАЧЕНИЕ В БАЗЕ',
'type' => 'numeric'
),
array(
'key' => 'rating',
'value' => 'САМОЕ БОЛЬШОЕ ЗНАЧЕНИЕ В БАЗЕ',
'type' => 'numeric'
)
)
);
$true_query = new WP_Query( $true_args );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question