Hi everyone,
I’m hoping someone can point out what I’m obviously missing.
I’ve got a CPT with a custom field, I want to query three different values from a custom meta field. I can get it working like so:
‘meta_query’ => array(
array(
‘key’ => ‘event_category’,
‘value’ => array(‘past’,’upcoming’,’current’),
‘compare’ => ‘IN’
),
),
I then wanted to modify the query so that I can present the results in a certain order, so I modified it like so:
‘meta_query’ => array(
array(
‘relation’ => ‘AND’,
‘currentarray’ => array(
‘key’ => ‘event_category’,
‘value’ => ‘current’,
‘compare’ => ‘IN’,
),
‘upcomingarray’ => array(
‘key’ => ‘event_category’,
‘value’ => ‘upcoming’,
‘compare’ => ‘IN’,
),
‘pastarray’ => array(
‘key’ => ‘event_category’,
‘value’ => ‘past’,
‘compare’ => ‘IN’,
),
)
),
‘orderby’ => array(
‘currentarray’ => ‘DESC’,
‘upcomingarray’ => ‘DESC’,
‘pastarray’ => ‘DESC’
),
But suddenly I get no results returned at all.
Can anyone identify what I’ve missed here?
[ad_2]