WordPress 4.0 allowed you to specify multiple orderby parameters and set the order of each independently.
How to do it? Just make multiple refferences, here is one way to do that.
$args = array(
'orderby' = > array(
'title' => 'ASC',
'date' => 'DESC',
)
);
But only since WordPress 4.2 it is possible to do this with meta values. Have a look at this post.
Related Posts:
- How to orderby multiple meta fields if some fields are empty
- WP_Query custom order and pagination
- Meta query orderby meta_value_num sorting by role first
- WP Query. Ordering posts by another post types meta
- Sorting: custom query with orderby meta_value_num THEN by title
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Query WooCommerce orders where meta data does not exist
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Order posts by tags count?
- Add and in the header while looping over custom query in page template
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Transient pagination not working properly
- Order WP Query posts by custom order calculated from post meta values
- Custom Post order for homepage
- How to output different posts per page?
- Meta query with order by another custom field
- Order Posts by meta value AND published date
- Meta Query for specific months
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- How to orderby meta_value_num with dollar ($) sign
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- pre_get_posts order by not working
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- Optional Meta Query
- Overwrite YoastSEO meta-tags with another page’s [closed]
- Weird orderby => post__in issue
- Order by summing multiple values
- Order by empty custom field
- Multisite pagination issue by multi query archive 404
- Help ordering Post loop by two meta values
- Order ascending is ignored in meta query?
- meta_value_num not ordering all items
- Meta Query relation “AND” then set array accordingly
- How to filter a query by multiple meta keys and order by other meta keys
- Advanced WP_Query with meta_query, orderby?
- How to set up hierarchical relationships without using plugins / meta query
- Yoast primary category query modification
- Notice thrown when creating numeric pagination on custom query
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- WP_User_Query orderby meta_val_num
- Unable to paginate a custom page query
- I am officially missing something about transient posts
- Why doesn’t my WP Meta Query return any results?
- WP_Query meta compare must include ALL array values
- Sort posts using multiple custom fields and menu_order in single query?
- meta_query where the meta value is not the post title
- Query multiple post types, but different order for each
- Pagination of custom page with custom fields query
- What’s wrong with this meta query? (order by meta key, then title, doesn’t work)
- Woocommerce Get Orders By Meta Value
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- WordPress Query custom ordering by temporary variable
- WP_User_Query Orderby Not Working
- Order posts by tags count?
- Query against multiple locations within single custom post type post
- Why pagination is not working with tax_query param?
- Strange results from WP_Query
- How to get_comments() ordered by date and parent?
- Sorting with meta_query and multiple, optional meta keys
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- wp_query sorting – one specific meta_key value at last and then sort by create date
- What is the best way to reset a search on a meta_key / meta_value?
- How can I modify standard search query to include also ACF custom fields values?
- Best way to Order Post in Home without a plugin
- orderby in WP_QUERY – Use the order from the Dashboard
- Custom pagination (Title, date and teaser)
- Filter posts/pages by user_role array
- Using orderby with 2 meta keys
- WP_Query with meta_value_num and meta_query not paged correctly
- Pagination is not working on custom query inside a custom home page template
- Pagination in custom query in a category page
- Horizontally paginate through sets of blog posts?
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query with several meta_query-statements and order by meta_value
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Pagination in WP query with transient API
- Get posts that were most recently tagged
- Use meta query only 3 or more results?
- Search results stuck on page 1
- Use value from meta key array for use in WP_Query
- Meta_query compare operator explanation
- Query Multiple Post types each with own meta query
- WP_query and pagination?
- WP Query – Get WooCommerce Products with variation that is in stock
- Sorting posts DESC based on the number of comments using WP_Query
- Add quicklink to in the Admin posts page where I can query by a meta_key
- Cutom wp_query for geolocation search, pagination not working
- Tax query AND/OR meta query [duplicate]
- Custom query filter by ACF date custom field
- Sorting posts by Multiple custom fields in defined order
- Disable (or limit) queries when certain content (or data) is not needed (or showed)
- WP_Query on custom key and value
- WordPress meta_query not working
- Divide WP_Query posts by date & post type
- New WordPress WP Query using posts from certain categories
- Display only posts with thumbnails