WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom post type that describes components of a product. As the product is developed new components are added. I'd like to define what version of the product the component was added, and then be able to browse products by that version.

I tried making a custom taxonomy as the version, but my problem is when I browse that version. I only see the components added for that version. I need to include all components for that version and previous versions.

Is taxonomies that right approach or is there another way to handle this in WP?

share|improve this question
up vote 2 down vote accepted

Taxonomies is not the right approach here, you should use custom fields (post meta) instead this way you can use compare argument of the meta query as <= ex:

$args = array(
        'post_type' => 'product',
        'meta_query' => array(
                        'key' => '_version',
                        'value' => '1.0',
                        'compare' => '<='
$query = new WP_Query( $args );
share|improve this answer
thanks, that's why I couldn't figure it out. Didn't know it was referred to as meta. – ThinkingMedia May 26 '12 at 19:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.