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'm using the code below to try to exclude the format "post-format-quote", but it is excluding all posts, including ones of the standard format (no format).

            $myposts = new WP_Query(array(
                'tax_query' => array(
                    'taxonomy' => 'post_format',
                    'field' => 'slug',
                    'terms' => array('post-format-quote'),
                    'operator' => 'NOT IN'
                ),
                'posts_per_page' => 3
                )
            );
share|improve this question
up vote 3 down vote accepted

tax_query takes an array of arrays. Try this:

$myposts = new WP_Query(array(
                'tax_query' => array(
                    array(
                        'taxonomy' => 'post_format',
                        'field' => 'slug',
                        'terms' => array('post-format-quote'),
                        'operator' => 'NOT IN'
                    )
                ),
                'posts_per_page' => 3
                )
            );

Further reading: http://ottopress.com/2010/wordpress-3-1-advanced-taxonomy-queries/

share|improve this answer

Your Answer

 
discard

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.