[wp-hackers] Custom Taxonomy Query - Select posts with a taxonomy AND none
Alex Hempton-Smith
hempsworth at gmail.com
Tue Mar 26 01:30:45 UTC 2013
Hi all,
I have a CPT with three taxonomies:
- Segment
- Price Band
- Descriptive Tag
Most posts would have one of the above assigned to them, but some posts
might be relevant for ALL segments, or ALL price bands, so they don't have
ANY specified.
How do I include posts in EVERY WP_Query if there is NO segment/price band
specified?
For example, if I search for:
- Segment = X
- Price Band = Y,Z,A
- Descriptive Tags = B,C,D
I get all posts that match X,Y,Z,A,B,C and D. But I'd like all posts with
NO segment/price band to ALSO be included in this result. As they are
assumed if they have nothing specified, they are relevant to ALL searches.
Does this make sense?
Thanks for your patience as I try to describe what I'm trying to achieve!
Alex
More information about the wp-hackers
mailing list