Multiple orderby on query
-
Hello,
I can’t do a multiple sort with the post date field and a custom field.
If I use only one field, the sort is performedquery
===============
add_action( ‘elementor/query/q_img-copertina-max’, function( $query ) {
$meta_query = [[
‘key’ => ‘visibile’,
‘value’ => ‘1’,
‘compare’ => ‘=’,
] ,
[
‘key’ => ‘vis_cop_cat’,
‘value’ => ‘1’,
‘compare’ => ‘=’
],];
$query->set(‘meta_query’, $meta_query);
$query->set(‘meta_key’, ‘ordinamento’);
$query->set( ‘orderby’, array(
‘post_date’ => ‘desc’,
‘ordinamento’ => ‘asc’,));
thanks for attention
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Multiple orderby on query’ is closed to new replies.