Quick question: I would like to retrieve some pages/posts with a meta value inside a range, eg) $min<$meta_value<$max
for ordinary $meta_value there was a way to get pages/posts like this:
$args = array(
'meta_key' => $key,
'meta_value' => $meta_value, //$min<$meta_value<$max
'post_type' => 'page',
'post_status' => 'publish',
...
);
$pages = get_pages( $args );
What is the best solution? should I first get them all and check them in an if condition or should I use $wpdb->get_results($sql,OBJECT)
or is there a better way?
From SQL we have:
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
Does the WP_query
class have a method to use the BETWEEN
keyword inside a query?