From the get_terms
documentation:
orderby (string)
: Field(s) to order terms by. Accepts term fields (‘name’, ‘slug’, ‘term_group’, ‘term_id’, ‘id’, ‘description’), ‘count’ for term taxonomy count, ‘include’ to match the ‘order’ of the $include param, ‘meta_value’, ‘meta_value_num’, the value of $meta_key, the array keys of $meta_query, or ‘none’ to omit the ORDER BY clause. Defaults to ‘name’.
Example:
get_terms([
'taxonomy' => 'topic',
'orderby' => 'field',
'order' => 'ASC/DESC',
]);
Related Posts:
- Nested meta_query with multiple relation keys
- Multiple relationship for multiple tax_query in WP_Query
- WordPress tax_query “and” operator not functioning as desired
- Conditional arguments for WP_Query and tax_query depending on if $somevar has a value
- Escaping WP_Query tax_query when term has special character(s)
- Does tax_query really beats meta_query in all situations?
- Tax_query terms ID’s using variable
- Why is my WP_Query not working when tax_query terms are an array?
- if wp_query taxonomy term have posts
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to combine tax_query and date_query in WordPress
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- How to extend tag and category “Related Posts” query to custom post_type if the first 2 terms have no posts
- Using tax_query reverses my post_type argument in a custom WP_Query
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Find all product that contain terms with %keywords% in WP_Query
- Get term by custom term meta and taxonomy
- tax_query shows no results if nothing is selected
- WP_Tax_Query with post_tag not working
- get complex results set according to category structure
- WP_Query tax_query problem
- How to add terms to my tax_query based off of the current post
- Query all posts in a given taxonomy
- Change default ordering of taxonomy terms – pre_get_terms
- tax_query OR with empty result returns all posts
- WP_Query, tax_query and term_meta: How to?
- Is it possible to dynamically get queried term AND taxonomy?
- Empty tax_query array returns an empty array
- How can i simulate “taxonomy__in” in query?
- Get list of terms that have posts in another term
- pre_get_posts Remove tax_query Completely
- tax_query: Order by slug?
- Meta Query relation “AND” not working
- Tax query clause inside a meta query clause?
- Nested tax_query that allows specified categories OR tags, but NOT other categories
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- Populate tax_query terms parameter with post term
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- Fetch posts that match term slug first two letters (wp query)
- Is it a good idea to improve meta query performance by adding tax query?
- WP_Query | Tax_Query Relation | Unable to use ‘OR’ as it then allows all products, help me finish my query?
- WP_Query tax query part of slug
- Taxonomy Query Relation field not behaving correctly?
- Tax query AND/OR meta query [duplicate]
- Query with meta_query and tax_query together not working properly
- Adding a tax_query to a WP_Query Object
- Finding WordPress Posts assigned to multiple categories
- Tax Query only returns for the first of several terms
- exclude product with available tag
- How to add tax_query to $args with concatenation
- How to print term name inside wp post loop
- Get posts in taxonomy randomly
- Loop posts based on permalink term
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- Is it possible to add relation between meta_query and tax_query?
- How to restrict search on a certain page to only return results against custom taxonomies?
- Function using get_posts() with tax_query not working when called from functions.php
- Tax_Query using WP_Query not working
- Show multiple tax_query from 2 or more post_type in a single code
- Any quicker alternative for WP_Query “NOT IN”
- Tax Query on product_cat using NOT IN as operator does not exclude that category
- Facing problem with tax_query results
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- WP_Query for a taxonomy value OR a custom post type meta field
- wp_query with meta_query and tax_query
- Select multiple categories with is_tax
- list all post who have mutual taxonomy as current taxonomy!
- Why pagination is not working with tax_query param?
- WordPress post_status and meta_query
- Query child posts with tax query on parents
- posts_per_page in a tax_query
- Tax_Query not working – connecting to second wordpress database
- WordPress tax_query ignoring relation OR
- Optimal way to make tags in tax_query optional?
- in tax_query this Is the code correct? I need to access beginner video posts for different subject
- display all posts from category with and without terms in chronological order
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- How can I get all the posts that are related with a specific taxonomy term?
- Woocommerce orderby rand with tax_query not random
- How to combine nested tax_query logic with other nested query logic?
- Custom taxonomy and query multi conditions
- tax_query not working for taxonomy slug
- Escaping WP_Query tax_query when term has special character(s)
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- Custom query for tag and custom tag from 2 post type
- WP_Query: Meta_Query with serialized value (or a workaround)
- Multiple tax_queries: display posts titles from several custom taxonomie
- Escaping WP_Query tax_query when term has special character(s)
- How to get hierarchical number of custom taxanomy
- List posts of terms but exclude one term
- Get the tax term in which is a post via wp_query
- Output ACF field dynamicaly within a taxonomy loop [closed]
- WP_Query with tax_query not working
- Custom query for certain post type OR another post type with a certain category
- Custom query with custom filtering returning incorrect results
- How to get an array of post data from wp_query result?
- Why query_vars get altered in WP_Query Object?
- Only display post if published in last 24 hours?
- WP_Query by keyword OR post tag