WP_Query on custom field and order results

I have this:

                    $custom_query_args = array(
                    'post_type'     => 'mcg_event',
                    'posts_per_page'    => -1,
                    'meta_query' => array(
                        'relation' => 'AND',
                        array(
                            'key' => 'event_status',
                            'value' => 'archived',
                            ),
                        array(
                            '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

Leave a Reply

Your email address will not be published. Required fields are marked *