If you use the more generic get_terms you can include in the $args field all of the information to get the term or the children and specifically say what you want to order by and how you want it to be ordered.
Ex.
$termchildren = get_terms( "location",
array(
'child_of' => 4,
'orderby' => 'name',
'order' => 'ASC'
)
);
child_of
: Get all descendents of this term. Default is 0. Make sure you use an integer value. Like 1, 2, 3, 4 and not ‘1’, ‘2’, ‘3’, ‘4’.
parent
: Get direct children of this term (only terms whose explicit parent is this value). If 0 is passed, only top-level terms are returned. Default is an empty string.
Related Posts:
- How can I order a post query’s results based on the number of matching taxonomy terms?
- Why is my WP_Query not working when tax_query terms are an array?
- List taxonomy terms plus their latest post ordered by post date
- How to add terms to my tax_query based off of the current post
- Change default ordering of taxonomy terms – pre_get_terms
- Pass array of taxonomy terms to wp_query
- Formulate a url to show posts with both taxonomy terms
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- Order by slug in get_terms with multiple taxonomies
- Function get_queried_object() return NULL in custom taxonomy
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Get authors by term id or slug
- How to order posts by title after they have already been sorted by category
- Taxonomy order exception for specific term
- Get posts from multiple tax terms
- How to add custom meta to ‘pre_get_terms’?
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- Only show tag with the same id as the post
- Save queried result into database
- taxquery taxonomy get terms
- How to show terms from another taxonomy
- How to define a custom hierarchy for terms?
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- WP_Query orderby date not working
- Order by optional meta key?
- WP_Query order by multiple meta keys & fields
- WP query taxonomy input differs to output?
- How to get order of posts?
- How do I order pages and categories by ID or name in the same query?
- Get list of posts which have at least one term from a custom taxonomy with WP_Query
- Merge 2 args in one WP_Query and order it by date
- Revolution Slider Orderby Two Custom Fields
- Get random terms
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Filter and list posts of a custom taxonomy
- Filtering posts by custom field value not working
- Display link to taxonomy archive only if it has posts with certain custom field values
- WP_Query Order by Specific Post ID First
- Get list of terms that have posts in another term
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- Orderby ASC changes to DESC in WP_Query
- is_tax() function not working as expected
- Custom post taxonomies as tax_query terms?
- Weird orderby => post__in issue
- WP_Query tax query part of slug
- Taxonomy Query Relation field not behaving correctly?
- Advanced ordering of query_posts
- Post loop for all taxonomy terms
- Taxonomy and Date in same query?
- Filter Custom Taxonomy Posts
- How to Create a Random List of Child Pages
- Using custom taxonomies in a query
- Specify strict ‘order by’ in WordPress query
- get_the_terms – but only show 4 Posts
- Count posts per taxonomy else change taxonomy if less than x number
- get term id from term name
- Get Child Category only
- Order is breaking wp_query
- WP_Query to output chosen term and posts with no term assigned
- How to echo woocommerce category name
- WP Query – filtering terms with regex
- How order posts from category by date and comment count?
- Orderby two meta fields not working
- relation OR instead of AND – Filtered term ID’s in loop
- Order taxonomy terms wordpress
- Avoid WP_Query’s duplicate posts with taxonomies
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- Exclude post with taxonomy and from the terms (taxonomy & tag) posts count
- WP_Query order by multiple meta keys & fields
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- Get categories within specific term
- WP_User_Query Orderby Not Working
- How to display Woocommerce products list by tag
- Query Order By Number Variable From API
- Order 2 meta_queries differently in WP_Query?
- Order & Orderby clause not working with custom query
- Custom taxonomy and query multi conditions
- Best way to Order Post in Home without a plugin
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- Query All Attachments and Order by Parent Publish Date
- Add a custom variable to query page object
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Order WP_Query results in order other than ASC or DESC
- Custom query to order by multiple taxonomies
- Get the tax term in which is a post via wp_query
- Sorting: custom query with orderby meta_value_num THEN by title
- Get post closest to today
- orderby in WP_query doesn’t works
- Displaying Results From Custom Taxonomy Query
- Order by meta values
- Order taxonomy terms by the frequency of use in the last 30 days
- orderby and order filter in get_posts or WP_query function in wordpress not working
- tax_query not working properly with get_posts
- Get access to all terms associated to each post that the wp_query loop displays
- Why does wp_query only display the most recent post when using order ASC?
- How to put posts with some taxonomy on top of others in `pre_get_posts`
- new WP_Query with order args – no more distinction between categories