Change your code with this and might help you with what you are looking for. The issue here is that we cannot include key
, order
and orderby
in meta_query
. But if you want to order you result posts based on key than you can pass the query arguments as below:
$custom_query_args = array(
'post_type' => 'mcg_event',
'posts_per_page' => -1,
'order' => 'ASC',
'meta_key' => 'event_start_date',
'orderby' => 'meta_value_num',
'meta_query' => array(
array(
'key' => 'event_status',
'value' => 'archived',
),
)
);