Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 2 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
add comment

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.