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

<?php
                /**
                 * 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',
                        array(
                            'taxonomy' => 'clasificacion',
                            'field' => 'slug',
                            'terms' => 'avisos'
                        ),
                        array(
                            '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

1 Answer 1

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

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.