Wordpress - How do I query by post format in WordPress 3.1

This code is incorrect! You have

'taxonomy' => 'post-format'

But it really needs to be:

'taxonomy' => 'post_format'

Without the underscore, the query will be invalid. I just tested this on my WordPress 3.1 install after pulling my hair out for hours.

Hope that helps!!


in tax_query "terms" accepts array so you need to put post-format-quote in an array like this:

$args = array(
  'tax_query' => array(
    array(
      'taxonomy' => 'post-format',
      'field' => 'slug',
      'terms' => array('post-format-quote')
    )
  )
);
query_posts( $args );