Hi,
I’m trying to add a filter to a custom query for a custom post type, sorted on a meta field. This works fine until I add a secondary sort order (the query sorts on a date field and then on a time field), then the query order jumps to the default – post date ASC. The filter still works so that’s not the issue, it’s that it breaks my query sort order.
The custom query $args looks like this:
$args = array(
‘post_type’ => ‘myCPT’,
‘paged’ => $paged,
‘meta_query’ => array(
‘relation’ => ‘AND’,
‘date_clause’ => array(
‘key’ => ‘myCustomDateField’,
‘value’ => $today,
‘compare’ => ‘>=’
),
‘time_clause’ => array(
‘key’ => ‘myCustomTimeField’,
‘compare’ => ‘EXISTS’,
),
),
‘orderby’ => array(
‘date_clause’ => ‘ASC’,
‘time_clause’ => ‘ASC’,
)
);
$args[‘search_filter_id’] = 1;
Is this expected behavior (as in: it’s outside the scope of the plugin) or am I doing something wrong?
Thanks