query taxonomy less than a value
I have a custom taxonomy (delay) associated with a custom post type (article). I am trying to figure out a good way to build the query without resorting to building the query in sql. All of the content of delay is captured as integers, so the following query does work, but i’m looking for a better solution that keeps with the spirit of using wp_query.
$querystr = 'SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) INNER JOIN wp_terms ON (wp_term_taxonomy.term_id = wp_terms.term_id) WHERE 1=1 AND wp_posts.post_type = \'article\' AND (wp_posts.post_status = \'publish\') AND (wp_term_taxonomy.taxonomy = \'delay\') AND (CAST(wp_terms.name AS SIGNED) <= ' . $dayCount . ') ORDER BY (CAST(wp_terms.name AS SIGNED)) ASC LIMIT 0, 150';
plus it doesn’t play well with paging as it stands right now.
- The topic ‘query taxonomy less than a value’ is closed to new replies.