Skip Navigation

[Resolved] Filter CPTs by taxonomies of a connected post

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ben 5 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#1213364

Ben

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!

#1213723

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

#1214213

Ben

Thanks Waqar!

This is the perfect solution!