I have this:

                    $custom_query_args = array(
                    'post_type'     => 'mcg_event',
                    'posts_per_page'    => -1,
                    'meta_query' => array(
                        'relation' => 'AND',
                            'key' => 'event_status',
                            'value' => 'archived',
                            'key'       => 'event_start_date',
                            'orderby'       => 'meta_value_num',                     
                            'order'         => 'ASC',

I am looking to do 2 things: 1) only fetch events that have an event_status of ‘archived’ and 2) order the results by event_start_date.

I can do either of these queries separately with no problem – but when I put them together as above the order makes no difference.

What am I missing? Apologies if it’s obvious, have done a bunch of searching but can’t find an obvious answer…

Read more here: WP_Query on custom field and order results


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: