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 have searched and found some aprroved answers to similer questions
but nothing i could make work or something exactly like my issue...

i have 5 custom post type...
each one have its own taxmonies and inside all of them i have created
a category called specials... i need to pull all posts marked with this category from all post types...

i have currently stuck starring at this code which doesent work..

$itemsAmount = of_get_option('sg_specials_amount');

    'post_type' => array('engagement_ring', 'wedding_ring', 'pendants', 'earrings', 'bracelets'),
    'posts_per_page' => $itemsAmount,                       
    'tax_query' => array(
        'relation' => 'AND',
            'taxonomy' => 'wedding_cat',
            'field' => 'slug',
            'terms' => 'specials'
            'taxonomy' => 'engagement_cat',
            'field' => 'slug',
            'terms' => 'specials'
    'orderby' => 'rand',
    'paged' => get_query_var('paged')                       
) );  

(in this example code trying to pull just from two taxomonies but would use five) .

if relevant then beneath the code i pasted here i have
the loop which can be found here: http://pastebin.com/ds4kFptq

Would appreciate your help Sagive.

share|improve this question
up vote 2 down vote accepted

At a glance, I would guess that the problem is your use of

'relation' => 'AND'

Using AND means that you will only return items that fall into all of the taxonomy terms. If you want to return items have any of the taxonomy items, change it to

'relation' => 'OR'

If that "doesn't work", please provide more details about what "it doesn't work" means :)

share|improve this answer
thank you very much. – Sagive SEO Mar 25 '12 at 19:45

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.