Boohoo why did I start a bounty for that 😉 The answer is pretty simple – add ‘type’ => ‘numeric’ to the meta query.
array(5) {
["posts_per_page"]=>
int(6)
["orderby"]=>
array(2) {
["uss_product_price"]=>
string(4) "DESC"
["uss_product_weight"]=>
string(4) "DESC"
}
["meta_query"]=>
array(3) {
["relation"]=>
string(3) "AND"
["sortprimary_clause"]=>
array(3) {
["key"]=>
string(17) "uss_product_price"
["compare"]=>
string(6) "EXISTS"
["type"]=>
string(7) "numeric"
}
["sortsecondary_clause"]=>
array(2) {
["key"]=>
string(18) "uss_product_weight"
["compare"]=>
string(6) "EXISTS"
}
}
["paged"]=>
string(1) "1"
["post_type"]=>
string(7) "product"
}
Related Posts:
- Sorting: custom query with orderby meta_value_num THEN by title
- Custom WP_Query order by post_meta and (author) user_meta
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Order WP Query posts by custom order calculated from post meta values
- Meta query with order by another custom field
- Order Posts by meta value AND published date
- pre_get_posts order by not working
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- How to orderby multiple meta fields if some fields are empty
- Help ordering Post loop by two meta values
- Order ascending is ignored in meta query?
- meta_value_num not ordering all items
- How to filter a query by multiple meta keys and order by other meta keys
- Advanced WP_Query with meta_query, orderby?
- Sort posts using multiple custom fields and menu_order in single query?
- What’s wrong with this meta query? (order by meta key, then title, doesn’t work)
- WordPress Query custom ordering by temporary variable
- Meta query orderby meta_value_num sorting by role first
- WP_User_Query Orderby Not Working
- Sorting with meta_query and multiple, optional meta keys
- WP Query. Ordering posts by another post types meta
- wp_query sorting – one specific meta_key value at last and then sort by create date
- Best way to Order Post in Home without a plugin
- Using orderby with 2 meta keys
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query with several meta_query-statements and order by meta_value
- WP Query Args – Title or Meta Value
- Order by optional meta key?
- WP_Query order by multiple meta keys & fields
- Does tax_query really beats meta_query in all situations?
- Query WooCommerce orders where meta data does not exist
- Execute a large WP_Query with many “AND” Meta_Queries?
- Query all posts where meta value is empty
- WP_Query min and max values
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Revolution Slider Orderby Two Custom Fields
- Meta-value query
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- pre_get_posts filter meta_query without conflicting existing meta_query
- Undefined property: WP_Query::$post
- Programmatically set ‘meta_query’ for filter
- Using WP_Query and WP_Meta_Query Outside of WordPress
- WP_Query meta_query >= date
- Extending woocommerce admin product search
- Tax query clause inside a meta query clause?
- Orderby ASC changes to DESC in WP_Query
- Optional Meta Query
- How do I make a meta_query OR relation work? [closed]
- Order by title without taking into account ‘the’
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Advanced ordering of query_posts
- Meta Queries – should nesting work after WP 4.1?
- WP_Query with meta_query dosen’t return results
- How to provide meta_key array to wp_query?
- Specify strict ‘order by’ in WordPress query
- How to set up hierarchical relationships without using plugins / meta query
- WP_Query of custom post type sorted by meta_key has unexpected results
- Meta query compare for ID’s greater than specific ID
- Is it possible to add relation between meta_query and tax_query?
- How order posts from category by date and comment count?
- Show single posts date, in a page of posts
- WP_Query Class custom field parameters
- meta_query where the meta value is not the post title
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- WP_Query order by multiple meta keys & fields
- Query on meta values and post title
- meta_query with meta values as serialize arrays
- Woocommerce Get Orders By Meta Value
- meta_query is overriding default search
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- Unusual high query of user meta data
- WordPress Query optimaization for slow query
- Query Order By Number Variable From API
- Meta query doesn’t remove placeholder escape before query
- WP Query Meta Query
- Query custom meta value – post view and date meta
- 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?
- Custom WP_query and integrating into theme file
- WP_Query – show posts where meta value and user_email match
- Query All Attachments and Order by Parent Publish Date
- WP_Query using meta_query with LIKE doesn’t return what it should
- Order posts by custom column using pre_get_posts
- Add filter to Orderby Parameter using Array
- Order WP_Query results in order other than ASC or DESC
- Return a single custom post from multiple meta queries
- Get post closest to today
- query post based on comparison
- Including ‘cat’ => $cat breaks meta_query
- meta_query compare not doing what I want it to do
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- 294 Queries on Mainpage of WordPress
- WordPress extremely slow when using get_posts with multiple meta_query relations
- How to put posts with some taxonomy on top of others in `pre_get_posts`
- Use value from meta key array for use in WP_Query
- WP_Query sort by ACF date field (newest first) with blank dates first