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
- Resetting post data to previous loop in nested loops
- Pagination returns 404 after page 20
- Make loop display posts by alphabetical order
- get custom post type by tag
- Does tax_query really beats meta_query in all situations?
- Query WooCommerce orders where meta data does not exist
- Execute a large WP_Query with many “AND” Meta_Queries?
- WP_Query min and max values
- Group posts by custom field
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Transient pagination not working properly
- get_posts() seemingly ignoring post_type
- How to show the posts of some category first, and then all other
- Pagination stops at page 6
- Paginated HTML Sitemap
- Meta query field order together with post_date order causes posts without the meta field to be unordered
- Why does the_content not work like others for a set post id?
- pre_get_posts filter meta_query without conflicting existing meta_query
- How to limit total number of posts in wp query loop?
- Undefined property: WP_Query::$post
- WP_Query meta_query >= date
- Extending woocommerce admin product search
- Pagination is broken and I need help fixing it
- How to display 7 most recent days of posts?
- Tax query clause inside a meta query clause?
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- Where is the WP_Query instance instantiated (when working with themes)?
- Optional Meta Query
- How do I make a meta_query OR relation work? [closed]
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- Show post number in widget loop
- Extend product search with meta in WooCommerce
- posts_per_page not working for first page of pagination
- Search form not working with custom query?
- WordPress ignoring LIMIT / posts_per_page despite being in wp_query
- Conflict with get_posts and the_content
- WP_Query with meta_query dosen’t return results
- How do I rewrite this loop as a new WP_Query style-loop?
- Trying to retrieve random post, getting a page
- How to set up hierarchical relationships without using plugins / meta query
- PHP – Loop custom post type categories within jQuery Tabs
- 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
- Performance concerns: index.php vs taxonomy-$taxonomy.php
- Why does apply_filters behave different inside and outside a loop?
- problem with the loop
- meta_query where the meta value is not the post title
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- 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
- Woocommerce Get Orders By Meta Value
- meta_query is overriding default search
- Multiple WP_Query args combinations according to post type
- WP_User_Query Orderby Not Working
- How to show specify category template for both parent and child category
- Pagination inside the blog page not working
- Unusual high query of user meta data
- Woocommerce featured products query no longer working
- WordPress Query optimaization for slow query
- Custom Query Pagination not working on static front page
- Meta query doesn’t remove placeholder escape before query
- query all posts published by certain user id
- Query custom meta value – post view and date meta
- 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
- Best way to Order Post in Home without a plugin
- Retrieving category pages from subcategory returns empty sets
- WP_Query using meta_query with LIKE doesn’t return what it should
- Iterate through ID’s in loop
- Loop through multiple custom fields with increasing number
- Different number of posts showing in development vs production server
- An archive page without post format (just standard post)
- Including ‘cat’ => $cat breaks meta_query
- Pull Instagram images into an existing loop?
- Multiple loop for “featured” items returns wrong posts
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- 294 Queries on Mainpage of WordPress
- 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
- How do I subquery with custom meta fields?