0

Is it possible to construct a WP_Query in such a way that once a (ACF) meta value exists on a post in the query the subsequent ones cannot contain this value?

For instance if I'm querying countries, then after the first post containing France on that field none of the next ones in the query will contain France? And once I get Spain neither France nor Spain can be in the next? etc. etc.

I know how to solve this by checking for value-existence inside the loop, I'm trying to create a performant and succinct query :)

2
  • Can't you just exclude posts with the countries meta set as france? Or do you want to include the first post set with france in your query? I'm not sure it's possible to do this in the query.
    – joshmoto
    Commented Nov 28, 2021 at 17:03
  • @joshmoto No, as described I only want to exclude France after I've gotten a post with that value. Same for Spain, Mexico, Greece, whatever.
    – Fluxian
    Commented Nov 28, 2021 at 19:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.