Support

Account

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);