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',
),
)
);
Related Posts:
- Display products from specific category in shop page
- Exclude post on loop by multiple meta key value
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Query sticky posts with thumbnails
- Any number in meta key (wp query)
- Array as ‘key’ in WP_Query
- How to provide meta_key array to wp_query?
- Wp_query with 2 meta keys and array of meta values
- Meta query compare for ID’s greater than specific ID
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- WP_Query not returning correct result with meta_query parameter
- show most viewed post
- Meta Query if Values Don’t Exist
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Meta query with string starting like pattern
- how to show posts that are missing a meta_value
- WP_Query: query posts by ids from array?
- pre_get_posts with get_posts
- Executing Queries in tag.php
- Query Custom Meta Value with Increment
- Identify which loop you are hooking into; primary or secondary?
- querying with custom meta field with meta_query
- Order by two meta keys
- multiple meta key but get server load is very high
- A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
- Exclude first 5 posts of specific categories in the main loop
- How to bring specific post to front of wordpress loop?
- Use meta_query to display events by date in custom field
- Why execute the_post()?
- Posts loop with pagination on a single post page
- WP_Query Order by Specific Post ID First
- Using WP_Query and WP_Meta_Query Outside of WordPress
- Using one WP_Query object within the loop of another WP_Query object
- If two first numbers exist in wp_meta_query value
- pre_get_posts order by not working
- What is the random string I am seeing when I use get_query_var?
- Custom Search Not Consistent with Results
- Display both standard posts in a specific category along with a custom post type in a single loop?
- Orderby is working with one query but not with other
- meta_query in WP_Query value is not accepting array
- 1/3 of posts different class
- Two loops on archive page
- How to order posts by title after they have already been sorted by category
- get posts by meta_key from inside key of post meta
- Help optimizing slow WP_Query with meta_query
- meta_value_num not ordering all items
- Meta Queries – should nesting work after WP 4.1?
- Meta Query relation “AND” then set array accordingly
- 2 weeks ago from meta query meta value
- How do I rewrite this loop as a new WP_Query style-loop?
- Trying to retrieve random post, getting a page
- Is it possible to add relation between meta_query and tax_query?
- PHP – Loop custom post type categories within jQuery Tabs
- WP_Query with one category in args shows other categories
- Ordering posts by custom field and grouped by month
- Show single posts date, in a page of posts
- relation OR instead of AND – Filtered term ID’s in loop
- Compare “Main” post ID to ID inside wp_query loop
- Custom template for password protected page
- WP_Query Class custom field parameters
- problem with the loop
- meta_query where the meta value is not the post title
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- Function the_posts_pagination() not compatible with WP_Query arguments
- meta_query with meta values as serialize arrays
- Prevent Duplicate Post Counted by Query
- Woocommerce Get Orders By Meta Value
- meta_query is overriding default search
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- WP_User_Query Orderby Not Working
- How to show specify category template for both parent and child category
- Unusual high query of user meta data
- Woocommerce featured products query no longer working
- WordPress Query optimaization for slow query
- Meta query doesn’t remove placeholder escape before query
- query all posts published by certain user id
- WP Query Meta Query
- Query custom meta value – post view and date meta
- How can I modify standard search query to include also ACF custom fields values?
- Custom WP_query and integrating into theme file
- modifying the loop multiple times with arguments passed through ajax to wp_query
- WP_Query – show posts where meta value and user_email match
- WP_Query causing links to not work
- WP_Query using meta_query with LIKE doesn’t return what it should
- Iterate through ID’s in loop
- Different number of posts showing in development vs production server
- Return a single custom post from multiple meta queries
- An archive page without post format (just standard post)
- query post based on comparison
- Including ‘cat’ => $cat breaks meta_query
- Pull Instagram images into an existing loop?
- Pagination in custom query not working [duplicate]
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- How to write a query-function as a query-shortcode?
- First post outside of loop, homepage only?
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- WP Query – Show custom posts only if user contain some user meta
- Show number of posts AND number on current page (cannot make it work)
- How to get products with the same custom attribute like ean code