I want to order my posts by tags with only one WP_Query()
In my WP_Query I would like to display
2 posts with tags portrait
2 posts with tags paysage
2 posts with tags portrait
2 posts with tags paysage
2 posts with tags portrait
2 posts with tags paysage
Etc…
And I need to order these posts by recents.
What is the query to do that ?
Thanks
PS : Sorry I cannot use code because I’m with my iPhone.
Like Eugene mentioned in his answer you need to run a query for each tag. I would create a foreach loop that went through each tag then queried the latest 2 posts from each.
It’s impossible to do with one query, even from database point of view (without unions).
I would recommend you to use separate queries for each term. Don’t invent a wheal, don’t over complicate your code.