(e.g. posts in with the term with slug ‘bob’, of the ‘people’ taxonomy).
The fact that tax_query is a two dimensional array means that you can have multiple taxonomy queries. In this case you may want to return posts which match all taxonomy queries (relation => 'AND' ) or posts which match at least one taxonomy query (relation => 'OR' ).
This construct allows you to query multiple taxonomies by using the relation parameter in the first (outer) array to describe the boolean relationship between the taxonomy queries.
tax_query
is a 2-dimensional array, each sub-array can be considered to be a taxonomy query, typical its of the form:(e.g. posts in with the term with slug ‘bob’, of the ‘people’ taxonomy).
The fact that
tax_query
is a two dimensional array means that you can have multiple taxonomy queries. In this case you may want to return posts which match all taxonomy queries (relation => 'AND'
) or posts which match at least one taxonomy query (relation => 'OR'
).As the codex:
states
For example:
returns all posts with
move_genre
term with slug ‘action’ AND does not have theactor
terms with IDs103
,115
,206
.On the other hand (notice
relation
change):returns all posts with either have
move_genre
term with slug ‘action’ OR do not have theactor
terms with IDs103
,115
,206
(or satisfy both).With
AND
the returned posts must have both terms.With
OR
the returned posts need only have one or the other.If they are returning the same then your posts you are querying probably all have both terms.