This is not possible with native API and you will probably have a rather bad time hacking up SQL for it.
This would be quite trivial to re–sort posts like this after they are retrieved with PHP code. if you use get_posts()
you get array you manipulate already and for a WP_Query
object array of results is available in public $posts
property.
Note this assumes you don’t need to paginate this query. In which case things get very messy very fast and back to the mountain of custom SQL.
Related Posts:
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- WP_Query orderby date not working
- Order by optional meta key?
- Sorting: custom query with orderby meta_value_num THEN by title
- Order by DESC, ASC in custom WP_Query
- WP_Query order by multiple meta keys & fields
- Secondary Sort (fallback) for WP_Query
- Query Posts in a Predefined Order
- How to get order of posts?
- Order posts by ID in the given order
- Sorting posts by custom date fields (non standard date format)
- How do I order pages and categories by ID or name in the same query?
- WP_Query sort by comment meta data
- Order posts by tags count?
- Merge 2 args in one WP_Query and order it by date
- Orderby = none not working [duplicate]
- WP_query ‘orderby=none’ Problem
- Revolution Slider Orderby Two Custom Fields
- Order posts ascending with number in title
- List taxonomy terms plus their latest post ordered by post date
- Ordering by meta_value AND date NOT WORKING with wp_query
- WP_Query orderby breaks when using AJAX?
- Custom Post order for homepage
- Change default ordering of taxonomy terms – pre_get_terms
- WordPress WP_Query orderby being overwritten
- WP_Query Order by Specific Post ID First
- Order Posts by meta value AND published date
- How can I pick a single post from the latest 3?
- Sorting posts DESC based on the number of comments using WP_Query
- Order WP_Query by multiple fields, subtracting them from one another
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- pre_get_posts order by not working
- (Solved) WP_Query ($ args) -> How to sort letters and numbers within the same array
- Orderby ASC changes to DESC in WP_Query
- How to set multiple `orderby` in query argument?
- WP_Query order result by date AND meta_value
- Order by title without taking into account ‘the’
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Weird orderby => post__in issue
- Order by summing multiple values
- Understanding the orderby in WP_Query?
- Order by empty custom field
- How to order posts by title after they have already been sorted by category
- Advanced ordering of query_posts
- Help ordering Post loop by two meta values
- meta_value_num not ordering all items
- How to Create a Random List of Child Pages
- Advanced WP_Query with meta_query, orderby?
- Specify strict ‘order by’ in WordPress query
- Order is breaking wp_query
- How order posts from category by date and comment count?
- Child pages not affected by orderby
- Filtering by multiple conditions in the loop
- WP_User_Query orderby meta_val_num
- WP_Query custom order and pagination
- Orderby two meta fields not working
- Sorting posts by Multiple custom fields in defined order
- orderby ignored by wp_query
- Sort posts using multiple custom fields and menu_order in single query?
- WP_Query order by multiple meta keys & fields
- How to sort wordpress posts already selected by WP_QUERY
- Custom WP Query order function possible?
- Custom order of posts in wp_query and different taxonomies
- WordPress Query custom ordering by temporary variable
- Custom order revolution sliders post base slides as inserted in Specific Posts List field
- WP_User_Query Orderby Not Working
- Order by value of Custom Field using url string
- Order posts by tags count?
- Order by meta date with a thousanth of a second defaults to post order
- Order Element By Custom Field in WordPress
- Query Order By Number Variable From API
- How to get_comments() ordered by date and parent?
- Order 2 meta_queries differently in WP_Query?
- Sorting with meta_query and multiple, optional meta keys
- WP_Query: custom orderby (not ASC nor DESC)
- Best way to query posts and order by relevancy to query
- Order & Orderby clause not working with custom query
- Create custom order sortby based on array of id
- Best way to Order Post in Home without a plugin
- orderby in WP_QUERY – Use the order from the Dashboard
- Query All Attachments and Order by Parent Publish Date
- Order Custom Field by Price
- Using orderby with 2 meta keys
- 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
- Show sticky post before other WP_Query
- Custom query to order by multiple taxonomies
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Get post closest to today
- orderby in WP_query doesn’t works
- Posts2Posts, wp_query and orderby issue
- Order by meta values
- Change posts archive ordering
- orderby and order filter in get_posts or WP_query function in wordpress not working
- 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`
- WP_Query sort by ACF date field (newest first) with blank dates first
- new WP_Query with order args – no more distinction between categories