You might want to check out the query improvements in WP 4.2 for ‘orderby’ and ‘meta_query’. Details are on https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query.
Try to name your meta_query clauses, then order by them.
Following code is untested:
$query = array(
'order' => 'DESC',
'meta_query' => array(
'relation' => 'OR',
'cat1-clause' => array( 'key' => 'cat1', 'type' => 'numeric' ),
'cat2-clause' => array( 'key' => 'cat2', 'type' => 'numeric' ),
'cat3-clause' => array( 'key' => 'cat3', 'type' => 'numeric' )
);
'orderby' => array(
'cat1-clause' => 'ASC',
'cat2-clause' => 'ASC',
'cat3-clause' => 'ASC',
),
);
Related Posts:
- Query multiple meta values
- Why isn’t my `meta_query` array functioning properly?
- How to orderby multiple meta fields if some fields are empty
- Meta_query on same meta key, with diffrenct values
- Meta Query relation “AND” then set array accordingly
- WP Query Meta Value – How To Identify Specific, Unique Values?
- query post by author gender
- Meta query with compare by more than 2 fields
- Order (by ASC) posts with meta_key so posts without values are last
- WP_Query multiple value not working
- Get posts by meta value except one post [closed]
- Use REGEXP in WP_Query meta_query key
- compare meta_query in get_posts arguments
- Display products from specific category in shop page
- How to Compare Two Meta Fields
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Getting attachments by meta value
- WP_Query with meta_value LIKE ‘something%’
- Using custom meta_query with relation not working as expected
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- What is an efficient way to query based on post_meta?
- WP_Query not working as expected for attachments and custom meta_query
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Exclude post on loop by multiple meta key value
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Order By Multiple Meta Fields
- Advanced WP Query hogs the SQL server
- How to get user_id from wordpress database inside ajax function?
- How to use Meta Value Compare in WP_Query For Max and Min numbers
- Meta query with order by another custom field
- meta_query works locally but not on live server
- WP_Query with multiple meta fields filter?
- How to combine meta_query and post__in in WP_Query
- How to orderby meta_value_num with dollar ($) sign
- Meta Query Array Error 500
- How to do meta_query for attachments?
- Fetch Record based on meta key dates
- Suggestions on making this query/code more performant
- Large AND OR query timing out
- meta_query not working as expected
- Slow WP_Query with ‘OR’ on meta_query
- How to filter a query by multiple meta keys and order by other meta keys
- Query posts with “non set” meta value
- Ordering a mysql style datetime stamp with meta_query
- Meta Query doesn’t works as espected
- Wp_query with 2 meta keys and array of meta values
- Advanced WP_Query with meta_query, orderby?
- meta_query: check if number exists
- Event with multiple dates, display events chronologically
- Issues with search after added meta_query
- WP_Query: apply an SQL function to meta fileld value
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- How to create dynamic value in WP_Query meta_query
- How do I add an item to the WP admin menu?
- Multiple meta query from array
- WP Query / Meta Query [duplicate]
- Query posts by searching for a string in a meta field
- Query multiple post types, but different order for each
- How to add date_query to meta_query array
- Order by the first array within a meta_query
- Query ACF relationship field – Comparator IN – Value array
- Combine query in WP_User_Query()
- Multiple nested meta queries
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- Custom meta_query order for Elementor based on post meta key [closed]
- How can I modify the query by adding to the existing query?
- ElasticPress is (aparently) messing with my search filters
- Meta query ignores multiple values of the key
- Multiple meta_query not returning rows
- WordPress Query custom ordering by temporary variable
- Check for not NULL not working in meta query
- Comparing Meta Field date in WPQuery using Meta_Query?
- How to create better WP_Query to look for date time which is anywhere between two meta values?
- Query against multiple locations within single custom post type post
- Order by Date Custom Field
- Filtering WP_Query based on wp_postmeta keys values
- Complex Meta Query
- Multiple meta_query not working
- compare for multiple meta values for same key in wp_query
- Gather same custom field values in one value in a select tag with wp_query
- datetime picker, timestamps and meta queries
- WP_Query with meta_query won’t orderby
- meta_query only check if both value are set
- wp_query sorting – one specific meta_key value at last and then sort by create date
- Order posts by more than one variable (meta_key and publish date AND time)
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- meta_query not working with the_content()
- Using custom field as ‘orderby’ value causing post grouping by publish date
- how to query for meta_value have array
- Sorting Posts with meta value not working
- Set right order for query that returns posts based on two custom fields
- Looking for a way to exclude frontpage and nav menu from query filter
- Creating Custom Query
- WP_Query by meta key not returning any posts
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- WP Query – Show custom posts only if user contain some user meta
- How do I subquery with custom meta fields?
- Showing Counts on Comment List with Custom Query