query_posts ->using meta_compare / where meta value is smaller or greater or equals

Since WP 3.1, you can cast the meta value to anything you want using the ‘type’ argument in ‘meta_query’:

$args = array(
  'meta_query'=> array(
    array(
      'key' => 'vote',
      'compare' => '>=',
      'value' => 5,
      'type' => 'numeric',
    )
  )
  'posts_per_page' => 100
) );

query_posts( $args );

Leave a Comment

tech