0

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
                )
            );
3

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.