wp_query sorting – one specific meta_key value at last and then sort by create date
If you’re using WordPress 4.2 or newer then you can do the following: $args = array( ‘post_type’ => ‘products’, ‘posts_per_page’ => 10, ‘meta_query’ => array( ‘relation’ => ‘AND’, ‘tools_clause’ => array( ‘key’ => ‘tools’, ‘compare’ => ‘EXISTS’, ), ‘create_date_clause’ => array( ‘key’ => ‘create_date’, ‘compare’ => ‘EXISTS’, ), ), ‘order_by’ => array( ‘create_date_clause’ => ‘ASC’, … Read more