I’m not 100% certain what specific order you’re asking for, but you just need to assign an associative array to the ‘orderby’ value. Here’s an example:
$args = array(
'post_type' => 'brands',
'meta_query' => array(
array(
'key' => 'br_type',
'value' => 'Aviation'
),
array(
'key' => 'br_category'
),
array(
'key' => 'br_name'
)
),
'posts_per_page' => -1,
'orderby' => [
'br_category' => 'ASC',
'br_name' => 'ASC',
'br_type' => 'ASC'
],
'order' => 'ASC',
'fields' => 'ids'
);
Related Posts:
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- How to get user_id from wordpress database inside ajax function?
- meta_query not working as expected
- Multiple meta_key ordering with pre_get_posts
- Meta_query compare operator explanation
- Nested meta_query with multiple relation keys
- meta_query ‘compare’ => ‘IN’ not working
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query with checkbox meta_query
- ACF Relationship Field Search Filtering [closed]
- Query Multiple Post types each with own meta query
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Pagination custom query
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- Shortcode returns escaped HTML tags
- WP Meta Query for some meta (array) values
- Sort users by meta_value_num
- meta_query with array as value
- query posts in functions.php and update a field
- Using WP Query to search within ALL keys in meta query
- WP Query – Get WooCommerce Products with variation that is in stock
- Meta_query with or without value
- Meta-value query
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- Undefined property: WP_Query::$post
- Programmatically set ‘meta_query’ for filter
- posts_per_page not working
- WP_Query meta_query >= date
- wp_query not searching with apostrophe
- Extending woocommerce admin product search
- Complex Orderby Parameters: How to query with multiple orderby parameters using meta_value_num?
- How to delete taxonomy term when a wordpress user is removed?
- Custom query based on meta key – Reduce three states to two in results?
- Exclude category for main query and custom
- Performance when getting post meta for post retrieved by meta value
- Adding an array from a query string to a WP meta_query
- Query by multiple meta elements not seeming to work – wordpress is timing out
- Wp_query function to search from product_title ‘OR’ product tags name
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- How does one perform a sub query with different post types
- Tax query AND/OR meta query [duplicate]
- Help ordering Post loop by two meta values
- Display most popular in the past two days
- New WP_Query calls Pre_get_posts filter twice
- Error with function in functions.php?
- meta queries do ‘either/or’ checks
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Is this meta query problematic?
- Appending to existing WP_Query’s meta_query if exists
- Exclude authors IDs from WP_Query
- Get every post with value in meta key
- get_page meta query not working, maybe a bug?
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Custom query filter by ACF date custom field
- Query by date from custom field
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Nested array issue in meta_query
- Error in meta_query not get result
- How to get current page nearest parent id?
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- Sort posts using multiple custom fields and menu_order in single query?
- Order (by ASC) posts with meta_key so posts without values are last
- Search filter between promo and exact price
- meta_query – check for multiple meta values in key which holds an array of values
- WordPress Meta Query Null Values Order
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Why can my filter query SOME metadata but not other metadata?
- SEARCH QUERY PLEASE HELP | call_user_func_array() expects parameter 1 to be a valid callback php
- Getting posts by custom field value
- Finding post ID dynamically on click
- WP_Query on custom key and value
- Get posts having meta value between two numbers
- wordpress multiple meta value query is not working
- Strange results from WP_Query
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Pre get posts sort by meta key returns no results if meta key does not exist
- Sorting with meta_query and multiple, optional meta keys
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- Query by meta value (add a dropdown of all values)
- Order Posts By Custom Field That is an array of objects
- Orderby query does not work for custom fields even with meta query
- make query more simplest and in one query
- Calling a function with WP_Query only ever brings the first result
- WP_Query returns empty if meta_query has more than 7 values
- Fetching $_POST from Page Template into functions.php
- Use not custom fields in get_posts() meta_query?
- I wan to process the following js to process the AJAX Request on my function to calculate author Total Post views
- WordPress meta_query not working
- Using orderby with 2 meta keys
- Why WP_Query in functions.php is not working when get_posts works?
- Passing conditional arrays to WP_Query() [closed]
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Adding css tweak based on page template
- Get all user with both meta_value
- How do I have multiple metaqueries inside one wordpress query
- WP query with multiple custom meta not respecting orderby
- 1500+ duplicate queries via get_option function (query monitor)
- Display only posts with thumbnails