I've been scratching my head a lot and couldn't find a reasonable solution that would not require multiple queries.
In my case, the posts have multiple tags, but they can be divided into to "sets"
- Platforms (e.g. Facebook, Snapchat)
- Hashtags (e.g. cold, hot, scary)
What I need to fetch are posts that belong to given Platform (can be multiple platforms) and have one of the Hashtags.
Some examples to better explain the needed results.
- Checked tags: Facebook, cold, hot - results are posts that have "cold" and "Facebook" or "hot" and "facebook"
- More complicated: Facebook, Snapchat, cold, hot - results are posts that have "cold" and "Facebook", "cold" and "Snapchat", "hot" and "facebook", "hot" and "snapchat".
So basically I need all the posts for a given platform that have one of the hashtags.
I do have platforms and hashtags as separate arrays in code, so I can easily distinguish between them, but the problem is that they are all "tags" from Worpdress perspective.