In Views, is it possible to filter CPTs via the taxonomies of a connected post via a relationship?
For example, imagine there are two CPTs Countries and Cities. Countries has a taxonomy of Continents and every City is connected to the relevant Country by a relationship.
In this instance would it be possible to filter Cities by the taxonomy of Continents via the connected CPT of Countries?
I hope this makes some sort of sense!
Hi Ben,
Thank you for contacting us and I'll be happy to assist.
I'm afraid, this kind of filtering in views is not supported out-of-the-box and will require custom code.
Would it be possible for you to drop the "Continents" taxonomy and instead register a new custom post type "Continents"?
This way you'll be able to create a post-relationship between "Continents" and "Countries" (when "Cities" are already in a relationship with the "Countries").
In the view for "Cities" you'll be able to set a filter that should let visitor, first choose the "Continent" and then the "Country".
Example screenshots:
hidden link
hidden link
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Thanks Waqar!
This is the perfect solution!