I can’t work out why my wp query is failing, please help!

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?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here