Try to modify your query args to this:
$options['ind_start'] = array(
'label' => 'Start Date (Earliest)',
'query_args' => array(
'meta_query' => array(
'start_date_query' => array(
'key' => 'start_date',
'compare' => 'EXISTS', // Optional
),
)
)
);
meta_query
– will include only posts with any start_date
value.
Then add a WP query order filter:
function my_order_filter($orderby, $obj){
global $wpdb;
// Put here some conditional logic if you want to apply this only for a specific query.
$new_order_query_part = "{$wpdb->postmeta}.meta_value="-" ASC, {$wpdb->postmeta}.meta_value ASC ";
if( trim($orderby) ){
$orderby = $new_order_query_part . ', ' . $orderby;
} else {
$orderby = $new_order_query_part;
}
return $orderby;
}
add_filter( 'posts_orderby_request', 'my_order_filter', 10, 2 );
This filter will be applied to all queries. If you need to add order feature only to a specific query, then use some conditional filtering before applying the new order to the request.