I am trying to get all posts that belong to two or more taxonomies but I am failing...
So here is the pseudo of what I have.
taxonomy name = color-categories
I have 6 created items under color-categories:
red, blue, black, 2000, 3000, 4000
And each post will have 2 of those category combinations like (red,2000) or (blue,4000)...etc
But now let's say I want to pull all posts that are in 2000 and red only...how do I go about doing that?
This is the code I have thus far but not working:
$args = array(
'post_type' => 'item',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'color-categories',
'field' => 'slug',
'terms' => 'red'
),
array(
'taxonomy' => 'color-categories',
'field' => 'slug',
'terms' => '2000'
)
)
);
This results in nothing returned...
'terms' => array( 'red', '2000' )instead of two arrays and a relation in the'tax_query'? – Mike Madern Jan 11 at 9:20