[wp-trac] [WordPress Trac] #47493: Meta Query Sorting with relation => OR not behaving as expected
WordPress Trac
noreply at wordpress.org
Thu Jun 6 13:45:37 UTC 2019
#47493: Meta Query Sorting with relation => OR not behaving as expected
---------------------------+-----------------------------
Reporter: tcaneeaglepub | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.8.2
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
When sorting on multiple meta query clauses with the default AND relation
the sorting works as expected. When sorting with an OR relation the
sorting does not function as expected.
{{{
'meta_query' => array(
//'relation' => 'OR',// when turning this on the sorting does not
work..
'cornerstone_clause' => array(
'key' => '_yst_is_cornerstone',
'compare' => 'EXISTS',
'type' => 'BINARY',
),
'count_clause' => array(
'key' => 'erp_post_views_count',
'compare' => '>',
'value' => 0,
'type' => 'NUMERIC',
),
),
'orderby' => array(
'cornerstone_clause' => 'DESC',
'count_clause' => 'DESC',
),
}}}
The idea of the query is to first show any posts that contain
'_yst_is_cornerstone' and sort the remaining by 'erp_post_views_count'.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47493>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list