null last wp_query order code example
Example: sort even dont exists meta wordpress
$query->set( 'meta_query', array(
'relation' => 'OR',
array(
'key' => 'custom_meta_key',
'compare' => 'EXISTS'
),
array(
'key' => 'custom_meta_key',
'compare' => 'NOT EXISTS'
)
) );
$query->set( 'orderby', 'meta_value title' );