Title: Attribute Range Filtering Help Needed
Last modified: August 22, 2016

---

# Attribute Range Filtering Help Needed

 *  [chazmonro](https://wordpress.org/support/users/chazmonro/)
 * (@chazmonro)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/attribute-range-filtering-help-needed/)
 * I have an attribute for width that I would like to be able to filter via range…
   so I have a product with a width of 4.25 and when I do a search for any product
   with a width between 3 and 6 that product should display, but I’m not sure how
   to work with taxonomies… I’ve tried using this
 *     ```
       $query_args['tax_query'][] = array(
                       'taxonomy' => 'pa_width',
                       'terms' => array(3, 6),
                       'field' => 'slug',
                       'operator' => 'IN'
               );
       ```
   
 * But I don’t get any results. Is there a way to do this?

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/attribute-range-filtering-help-needed/#post-5348670)
 * This does not really answer your question, but if possible, the search would 
   be much easier if you can use a Custom Field to hold the width. The meta_query
   has a comparison operator of ‘BETWEEN’ that should work.
 * The only way I can think of to do the search on a taxonomy would be to use filters
   to join the wp_term_relationships, wp_term_taxonomy, and wp_terms tables and 
   add a ‘where’ clause to select the matching items. Much easier to use the Custom
   Field approach, if at all possible.

Viewing 1 replies (of 1 total)

The topic ‘Attribute Range Filtering Help Needed’ is closed to new replies.

## Tags

 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)
 * [tax_query](https://wordpress.org/support/topic-tag/tax_query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/attribute-range-filtering-help-needed/#post-5348670)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
