I think this is the syntax you are after:
$args = [
'posts_per_page' => 5,
'post_type' => 'post',
'meta_query' => [
'relation' => 'OR',
'rating_au_clause' => [
'key' => 'rating_au',
'compare' => 'EXISTS'
],
'rating_overall_clause' => [
'key' => 'rating_overall',
'compare' => 'EXISTS'
]
],
'orderby' => [
'rating_au_clause' => 'ASC',
'rating_overall_clause' => 'DESC',
],
];
It’s a subtle difference, but uses your named meta queries in an orderby array.
Related Posts:
- How can I create a meta_query with an array as meta_field?
- How can I query all users who registered today?
- How to List Events by Year and Month Using Advanced Custom Fields?
- Compare two numeric custom fields
- Advanced Custom Fields – Query Efficiency
- WordPress creating excessive joins on meta_query with search
- How to display liked posts of current user in wordpress?
- can’t get query to order posts by acf datepicker
- How can I apply a meta query for a single custom post type in the main query?
- How do I find if a page has a template?
- How to check current user in meta value array in WP_Query meta_query
- Query metas (and not : query posts by metas)
- Order posts by custom field DATE value
- How to orderby multiple meta fields with another meta query
- Query returning same results even though the ID changes
- Order by meta value pro first then meta value free in my search function
- get_users with array as meta_value
- Get the_field of Advanced Custom Fields in a custom query [closed]
- Advanced Custom Fields – Relationship post foreach query
- get_post_meta with WP_query
- Querying Advanced Custom Fields
- WordPress Mysql query and Duplicate
- How can I get the name of term post meta value which equals term id
- How to “orderby” the first array in a meta_query that uses multiply keys?
- Exclude in get_pages() based on meta field
- meta_query not working
- Restrict WordPress search to a single ACF field
- wp query multiple values > display a specific value first
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- How can I modify standard search query to include also ACF custom fields values?
- WordPress search form and search result through ACF field in custom taxonomy
- Fastest and most efficient SQL query to check if UID exists
- Query Posts that have or don’t have a meta_value and order by the same ASC
- What is the best way to query posts based on live data?
- Advanced Custom Fields Query with Different Values of the Same Key
- list or get meta_key where meta_value is ‘something’
- WP_Query orderby meta key/value suddely stopped working
- Modify a query using both a text field and a true/false AFC field
- Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155
- Use value from meta key array for use in WP_Query
- How to Optimize WP site for millions of posts
- Get Terms by IDs with IDs order
- Query WooCommerce orders where meta data does not exist
- How many WordPress SQL Queries per page?
- Slow wp_enqueue_media()
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- How to display lastest post date in the homepage?
- Sorting Grids with Essential Grid and Events Manger
- The use of including upgrade.php when building custom queries
- Slow meta_query with about 4 milion record on wp_postmeta
- WordPress Find Duplicate Post By Content
- WP Query Sort by meta value (date)
- mySQL query. ORDER BY meta_key
- how to query multiple categories in wordpress?
- Disable the MySQL query in the main query
- Strange string in console from wpdb query
- How can I get the query that would be run for the archive page?
- Select query for a login
- What’s wrong with my $wpdb prepare?
- where should I reset query after using get_results?
- Exclude featured image and custom field from this get_attachment query
- wpdb print all post meta
- Form and custom query problem
- Export Specific User data without plugin
- How to write: $wpdb->update having WHERE NOT value pair in the array
- wpdb COALESCE won’t work
- get csv of users with user_meta
- Custom SQL Query passing array to WHERE p.id
- Query does not return content
- Query posts dynamic date range
- Parse query filter in wordpress and relation
- get posts by tag to showing in a widget
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- List WordPress Post and Related Attachments outside of a post page
- Excluding posts by meta, and also keeping posts without the meta
- How properly create a blog template for wordpress?
- Problem on displaying the results on my query
- Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches
- Improve performance of slow query
- WordPress search in modified post title
- Cannot get sql request from Query object?
- Sort by postmeta on when searching
- Pulling an ACF into a query
- Meta query doesn’t remove placeholder escape before query
- Speed up search query that searches in post meta?
- WP Meta Query – mixed AND / OR query doesn’t work
- Using cron for multiple queries
- Set posts per page for parent category and it’s all children
- Exclude sticky posts from query
- If more than 1 image show post link?
- Rewrite Query_Var URL Parameter with Slug
- How to query different categories on index?
- How to specify what kind of is_single post?
- Can’t See Media Queries with Inspect Tool [closed]
- Print data from wordpress sql query
- Can I create my own query in wordpress with traditional methods?
- ‘Active lotteries’ only custom query for woocommerce lottery plugin and elementor
- How to show sticky posts on all pages of the pagination, not just the first page?