Home › Forums › General Issues › Visitor to Query Between 2 Numbers › Reply To: Visitor to Query Between 2 Numbers
You would use the BETWEEN
variation of the meta_query, and you would need to use a meta_query instead of the simple meta_key, meta_value parameters in your pre_get_posts filter (i’m assuming that’s what you meant the you said bottom of the page you linked to)
$meta_query = array(
array(
'key' => 'height',
'value' => array($min_height, $max_height),
'compare' => 'BETWEEN',
'type' => 'NUMERIC'
)
);
$query->set('meta_query', $meta_query);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.