[wp-hackers] Custom Taxonomy Query - Select posts with a taxonomy AND none

Mike Schinkel mike at newclarity.net
Tue Mar 26 02:55:02 UTC 2013


Hi Alex,

Maybe post your code snippet that is not working the way you want?  Might be easier to help that way...

-Mike

On Mar 25, 2013, at 9:30 PM, Alex Hempton-Smith <hempsworth at gmail.com> wrote:

> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list