Skip Navigation

[Resolved] Is there a way to filter taxonomy for the lowest item in each taxonomy branch?

This thread is resolved. Here is a description of the problem and solution.

Problem:

I want the LOWEST item in each taxonomy branch.

e.g. if a post is tagged as "Asia / Thailand / Bangkok" I want it to return "Bangkok.

Solution:

There isn't such kind of built-in feature within Toolset plugins, You need to edit that post, assign it with only one term.

Relevant Documentation:

This support ticket is created 3 years, 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by PaulS4783 3 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#2146377

ToolSet has a nice taxonomy filter option in Views of "Parent = none".
This will return the HIGHEST item in each taxonomy branch.
e.g. if a post is tagged as "Asia / Thailand / Bangkok" it would return the taxonomy term "Asia"

But actually I want to go in the opposite direction.
I want something like "Child = none".
Meaning that I want the LOWEST item in each taxonomy branch.
e.g. if a post is tagged as "Asia / Thailand / Bangkok" I want it to return "Bangkok.

Is there a way I can do this either with ToolSet native functions or with a Short Code custom taxonomy filter?

#2146521

Hello,

There isn't such kind of feature within Toolset Views/Blocks plugin, see WP document:
https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters

include_children (boolean) – Whether or not to include children for hierarchical taxonomies. Defaults to true.

The parameter "include_children" will setup as true by default, so in your case, you just need to edit each post, assign it with only one lowest term, for example "Bangkok", and test again.

#2146531

"The parameter "include_children" will setup as true by default, so in your case, you just need to edit each post, assign it with only one lowest term, for example "Bangkok", and test again."

Sorry. I can't understand what you are telling me to do here.

#2146545

As I mentioned above, there isn't such kind of built-in feature within Toolset plugins to achieve what you want:

I want the LOWEST item in each taxonomy branch.
e.g. if a post is tagged as "Asia / Thailand / Bangkok" I want it to return "Bangkok.

You need to edit that post, assign it with only one term: Bangkok

Hope it is clear.

#2147179

You can close the ticket.