I have this weird thing to do and I have no idea how to do it. Ok, so:
I have two custom taxonomies: collections
and categories
(both are prefixed, but for the sake of simplicity, I’ll use these short names). A post will have a category and will be added into a collection.
What I have to do is to display all posts from a specific taxonomy – categories
(already did this) and only show collections
terms that have posts in the selected category. Some kind of hide_empty
but based on another taxonomy. Make sense?
Since I use WPML plugin (that is known for adding stuff into sql query), I would like a solution that not involve the rewrite of the whole query.
So, any idea would be welcomed. Thanks!
You can try getting all the posts IDs from the first taxonomy
Then get the terms from the second taxonomy associated with them:
I did something that sounds familiar with your case and the easiest way to do it was using the Posts 2 Posts plugin.