Unfortunately, WordPress doesn’t have a built-in way to sort by taxonomy term. You do, though, have a couple of options.
-
You can iterate through your taxonomy terms and run a separate wp_query for each as this post shows.
-
You can directly manipulate the SQL query to achieve what you want. This article shows how. Look particularly at the last, Direct JOINs method.
Related Posts:
- How to sort a WP_Query array by post_name after an array_merge();
- Sort Posts with custom meta key by default which is currently set as optional
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Sorting: custom query with orderby meta_value_num THEN by title
- Sort posts by category name and title
- How to get order of posts?
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- WP Query orderby meta key natural sort?
- What kind of object type is WP_Query?
- How can I save an array from a random post sequence for later use?
- Getting an array out of WPQuery
- Loop through all tags & output posts in alphabetical list
- assign 2 $args to one wp_query
- Use Transient API to cache queries for all posts in all categories?
- Sorting Posts by custom field
- Sorting meta_value as integer doesn’t work
- WP Meta Query for some meta (array) values
- meta_query with array as value
- Sort in WP_Query(), not filter? Is it possible?
- Placing a div or img in between a post array using WP Query [closed]
- Show one post per author and limit query to 8 posts
- Front End Sorting Questions
- Woocommerce custom loop to show all the products [closed]
- Sort by meta key on archive page
- How to sort posts in admin by titles with dd.mm.yyyy format?
- Query Set Order By Author
- WordPress: Keep order of query_posts list of post ID’s using post__in
- How add a custom posttype name using ACF field to a query post array
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Meta query with order by another custom field
- How can I get an array of all IDs from the current queried object?
- How can I pick a single post from the latest 3?
- WP Query for variable taxonomies
- How to orderby meta_value_num with dollar ($) sign
- How do I sort posts with multiple pages
- Minimize database queries to user tables?
- WP_Query posts by distance based on LAT & LNG in Database
- Changing WP_Query params with url Query Var
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Adding an array from a query string to a WP meta_query
- Sort wordpress custom posts based on meta value
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Weird orderby => post__in issue
- WordPress Comments sort by custom meta key
- Understanding the orderby in WP_Query?
- How to list custom fields as headers and list all pages sharing that custom field under it?
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Help ordering Post loop by two meta values
- How to sort a custom wordpress query by combination of meta values?
- Gallery shortcode numerical sorting
- Query all posts if multiple meta key don’t exist
- WP Group posts by year(desc) > month(desc) > date(asc)
- Get posts by list of post IDs ordered by those IDs?
- Does wp track views for posts?
- how to get post order by post id wp_query?
- Sort WordPress Posts Meta value by Week not Day
- Removing duplicate values between two wordpress queries
- Include current post into loop
- Combine results of multiple WP_Query to resemble single WP_Query
- How do I turn these values from MYSQL into an array
- How to order WP_Query to group results?
- I am having problem sorting custom post type using WP_Query
- Does meta_value (array) work with ‘orderby’?
- search serialised meta_value for date value?
- Combine 2 arrays in a query parameter
- Sorting search results with custom dropdown
- Ignoring ‘a’ when sorting posts
- date_query problem
- Display three sequential posts on each page load, without repeating previous
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- Wrap group of wp query posts to parent div by date/year
- WP_Query: Meta_Query with serialized value (or a workaround)
- Sorting posts by meta values: 2 different orders
- how to query for meta_value have array
- wp_query – Modify $query to include duplicate content
- Iterate through ID’s in loop
- How to get several fields from wp_query?
- Sorting is not working in WordPress WP_Query
- Issue with WP_Query (need a array of selected ID’s)
- WordPress WP_Query Array Custom search via taxonomies
- WP Query posts__in not working with array
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Dynamically name array in WordPress loop – add/get values
- Dynamically create array from page title
- WordPress Query Returning Every Post
- Creating Custom Query
- wordpress sorting using array merge by price in ascending order but price with 0 must be show last
- have_posts order by title descending
- WP_Query – order with usort by custom meta
- How do I have multiple metaqueries inside one wordpress query
- I want to place a post before all others from an ACF boleen field
- wp_query, calculate with two dates when ‘key’ is text format
- Sort by multiple columns using get_posts
- Orderby meta _value that is saved as an array
- Query for posts belonging to multiple categories
- WP Query order posts not working
- How to `’orderby’ => ‘meta_value_num’` in a series of orderby parameters
- query loop “inherit query from template” prevents setting sort order