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've been trying with no success to show 2 custom taxonomies from 2 post_type, here's my code:

                 * Display a list of the most recent news in 'Avisos'
                $avisos_query = new WP_Query( array(
                    'post_type' => array('noticia','comunicado'),
                    'posts_per_page' => 5,
                    'tax_query' => array(
                        'relation' => 'AND',
                            'taxonomy' => 'clasificacion',
                            'field' => 'slug',
                            'terms' => 'avisos'
                            'taxonomy' => 'anos',
                            'field' => 'slug',
                            'terms' => '2011'
                ) );
                // Display the custom loop
                if ( $avisos_query->have_posts() ): 

I've been searching around here and WP but nothing.

Thank you!

share|improve this question
Have you confirmed that there are posts that have BOTH terms assigned to them? – mrwweb Jun 26 '12 at 5:07

Answering myself, the problem was the 'AND', must be 'OR', thank you anyway.

share|improve this answer

Your Answer


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.