If I’m understanding you correctly get_term_children
does what you want.
$term_id = 2;
$tax_name="locations";
$term_child = get_term_children( $term_id, $tax_name );
Another possibility would be using get_categories, it has an child_of
, taxonomy
and depth
parameter – the documentation on wp_list_categories, which offers pretty much the same functionality, is better.
Related Posts:
- Custom Taxonomy and Tax_Query
- “tax_query” parameter not working with WP_Query
- Including all terms in wordpress tax_query
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- search query within custom taxonomy term, post title and meta field
- Advanced Tax Query
- why do drafts return as part of wp_query?
- tax_query shows no results if nothing is selected
- Improving WP_Query performance for multiple taxonomies
- Advanced Query Logic With Multiple Taxonomies
- Hiding taxonomies with no children WP_Query & tax_query
- Set tax_query conditionally with new WP_Query
- How to do a particular wp_query taxonomy search
- Custom arguments in WP_Query
- check if a taxnomy queried in $wp_query?
- Query custom taxonomy for category including children
- how to use tax_query to apply both terms or one if one is empty
- list all post who have mutual taxonomy as current taxonomy!
- tax_query showing no results
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Advanced AND tax_query in sidebar with 2 taxonomies
- How to limit posts to 1 from each term with tax_query?
- wp_get_object_terms count on taxonomies within an category archive
- Complex Taxonomy scheme
- Show only the sub-categories (and their content) of the current custom taxonomy with ‘taxonomy.php’
- Using Advanced Custom Fields Relationship Field to select a taxonomy term
- Create alphabetical Pagination for custom taxonomy?
- How to restrict search on a certain page to only return results against custom taxonomies?
- Wp_query…a type of term a different div
- Taxonomy.php how to show post only in current taxonomy with wp_query?
- how to access the $query variable inside taxonomy-xxx.php template file?
- Proper way to create taxonomy queries
- Variable Not Working Inside is_author() Array
- Get current page term title to use in WP_Query
- passing moree than one value of slugs in taxonomy using variable
- Tax_Query using WP_Query not working
- How to get related taxonomies based on a category with mysql query?
- Get Posts Related to Category By category id or slug
- Display just the Post’s parent Category, not child
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Tracking the name of a custom taxonomy
- Add terms to a taxonomy archive from within the same taxonomy
- Display related CPT with custom taxonomy
- custom post type and a “sticky” position taxonomy
- Is it possible to filter a taxonomy archive by other taxonomies that are on posts?
- Fill New Taxonomies
- wp_query with meta_query and tax_query
- How to search through all child taxonomies using WP_Query?
- Custom Taxonomies Archive Page 404
- Tax-query on taxonomy doesn´t work
- how do you pull data from two taxonomies?
- Why pagination is not working with tax_query param?
- WordPress taxonomy terms archive template help
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- Optimal way to make tags in tax_query optional?
- WP Query tax_query not returning posts
- Error get_posts with Custom Taxonomy and OR relation
- Taxonomy Terms That Don’t Exist Display Results
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Make relation of custom taxomies
- WordPress Multiple Taxonomy Query
- How can I get all the posts that are related with a specific taxonomy term?
- How to combine nested tax_query logic with other nested query logic?
- tax_query not working for taxonomy slug
- Custom query for tag and custom tag from 2 post type
- List active taxonomy terms
- How to get hierarchical number of custom taxanomy
- taxonomy query on front page
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- List posts of terms but exclude one term
- How do you search for a post by custom taxonomy?
- Next/Previous links in custom taxonomy, where item may belong to multiple terms
- How to query authors by custom taxonomy?
- How do you move custom fields to custom taxonomies using WP Queries
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- Tax query array terms display out of order
- Order posts with custom taxonomy array
- Storing/querying custom date data
- Multiple loops on a Search result page?
- Getting grandchildren of a post with a specified custom taxonomy?
- Taxonomy Parameters in WP Query to get posts from two different taxonomies
- Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
- Custom Taxonomy + JQuery Tabs
- How to get multiple Taxonomies not All Taxonomies?
- How to update WordPress custom SQL Select query for custom taxonomies so that syntax is correct?
- How to query posts that are not related to any term of a taxonomy?
- Using wp_query is it possible to orderby taxonomy?
- WordPress Taxonomy Menu
- Primary Taxonomy for Post
- Output ACF field dynamicaly within a taxonomy loop [closed]
- Get taxonomy image for Toolset custom taxonomy through Toolset Views Shortcode
- List posts grouped by children of a custom taxonomy
- Make custom post type display with custom taxonomy in url
- Hook to filter based on form value and insert term
- WP Query Conditionally query meta and taxonomy
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Loop posts without any taxonomy
- Foreach for get_the_terms for hierarchical taxonomy don’t repeat Top Level Terms if contains multiple Second Level Terms