order by multiple meta keys in pre_get_posts

I want multiple orderby meta_query eg:

orderby(‘_property_price’ => ‘DESC’,’_property_featured’ => ‘DESC’)

This is what I am doing

$query->set('meta_key',array('_property_price','_property_featured'));
$query->set('orderby',array('meta_value'=>'DESC'));

In SQL, it should be like

ORDER BY _property_price, _property_featured DESC

Any Solution to this ?

Solutions Collecting From Web of "order by multiple meta keys in pre_get_posts"

Maybe a bit late …

    add_action( 'pre_get_posts', function($query) {
        if ( !is_admin() && $query->is_main_query() && is_post_type_archive( '[your_post_type]' ) ) {
            $query->set('meta_query', array(
                '_property_price' => array(
                    'key' => '_property_price',
                ),
                '_property_featured' => array(
                    'key' => '_property_featured',
                )                    
            ));
            $query->set('orderby',array(
                '_property_price' => 'DESC', 
                '_property_featured' => 'DESC'
            ));     

        }

        return $query;
    } );