$q = new WP_Query( array(
'meta_query' => array(
'relation' => 'AND',
'state_clause' => array(
'key' => 'state',
'value' => 'Wisconsin',
),
'city_clause' => array(
'key' => 'city',
'compare' => 'EXISTS',
),
),
'orderby' => array(
'city_clause' => 'ASC',
'state_clause' => 'DESC',
),
) );
You can use this query for ordering, even with more than one meta keys. These are called sub queries.
Please check this link from codex –
https://developer.wordpress.org/reference/classes/wp_meta_query/