$args = array(
'post_type' => 'event',
'meta_key' => 'start_date',
'meta_type' => 'DATE',
'orderby' => array(
'start_date' => 'ASC',
'menu_order' => 'ASC',
)
);
$posts = get_posts( $args );
Related Posts:
- When should you use WP_Query vs query_posts() vs get_posts()?
- When to use WP_query(), query_posts() and pre_get_posts
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- How to use the_posts_navigation for wp_query and get_posts?
- WP_Query vs get_posts
- Sorting: custom query with orderby meta_value_num THEN by title
- meta_query: using BETWEEN with floats and/or casting to DECIMAL
- Get posts from Network (Multisite)
- How to order by post_status?
- Using get_posts vs. WP_Query
- Delete all posts from WordPress except latest X posts
- Sanitation needed for WP_Query or get_posts calls?
- Differences Between WP_Query() and get_posts() for Querying Posts?
- Sort posts by category name and title
- How to get order of posts?
- Get Recent Posts by Date in Multisite
- get_posts with multiple categories
- get_template_part in for loop
- Use of caller_ get_ posts
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- WP Query orderby meta key natural sort?
- How-to exclude terms from the main query the most performant way?
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Query all posts where meta value is empty
- Loop through all tags & output posts in alphabetical list
- Get posts by meta data OR title
- Get_post() with meta_key when compare is a date
- get_posts not finding argument: post_name
- Meta Query with date and time on the same Day before given time
- Get posts with condition on comment meta value
- Function to check if author has posted within the last x days
- Sorting Posts by custom field
- Use post__in and post__not_in together?
- What should I use, get_posts or wp_query for less CPU load?
- Different Results with query(‘s=computer’) vs get_posts(‘s=computer’)?
- How to get post from all Blog Multisite to the Main Site?
- Sorting meta_value as integer doesn’t work
- WP Query post meta value
- Get all posts without tags
- Sort in WP_Query(), not filter? Is it possible?
- get_posts() seemingly ignoring post_type
- Can not switch the queried post in pre_get_posts hook
- Front End Sorting Questions
- How to find out what “Blog pages show at most” is set to [duplicate]
- Woocommerce custom loop to show all the products [closed]
- Sort by meta key on archive page
- Count posts returned by get_posts in external PHP script
- Trying to check and see if a post has a featured image outside of the main loop
- How to sort posts in admin by titles with dd.mm.yyyy format?
- WP_query category__in not working, only pulls from first category
- Query Set Order By Author
- WordPress: Keep order of query_posts list of post ID’s using post__in
- SELECT * FROM $wpdb->posts WHERE ID > 160
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Meta query with order by another custom field
- Adding multiple post queries with parent and children to page – Best Way
- How do you Query posts with nothing in common?
- Ignoring ‘a’ when sorting posts
- Slow query when selecting with large meta query or post__in
- I cannot get tax_query in get_posts() to work with custom taxonomy
- Getting the last X posts, but in ascending order of time
- Display three sequential posts on each page load, without repeating previous
- how to avoid reloading/refresh the page when displaying the post of wp_list_categories
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- Wrap group of wp query posts to parent div by date/year
- Sorting posts by meta values: 2 different orders
- Ordering Posts by parent category, name ascending
- Use not custom fields in get_posts() meta_query?
- Mathematical operations on custom field values? (updated)
- Display posts from catagories
- Both WP_Query and get_posts returning 1 post
- Sorting is not working in WordPress WP_Query
- How to sort a WP_Query array by post_name after an array_merge();
- When should you use WP_Query vs query_posts() vs get_posts()?
- get_posts works but new wp_query doesn’t
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Why WP_Query in functions.php is not working when get_posts works?
- Retrieve posts in custom post type and specific taxonomies
- Sort Posts with custom meta key by default which is currently set as optional
- Query specific number of posts for each post type in specific order
- wordpress sorting using array merge by price in ascending order but price with 0 must be show last
- get_posts shows current post, not defined posts with args
- Weird query with get_posts and WP_Query
- orderby and order filter in get_posts or WP_query function in wordpress not working
- tax_query not working properly with get_posts
- Query custom post types by meta field in a term from custom taxonomy
- have_posts order by title descending
- WP_Query – order with usort by custom meta
- How to replecate the _fields parameter in custom REST api endpoint
- How to retrieve _embed (etc) fields in get_posts custom query?
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Empty query on Custom Post Type, using WP_Query or get_posts
- A Depth Like Parameter For “get_posts”
- How to cache wordpress get_posts query using transients?
- When to use WP_query(), query_posts() and pre_get_posts
- WP Query order posts not working
- Equivalent of url_to_postid() for non-post URLs?
- How to `’orderby’ => ‘meta_value_num’` in a series of orderby parameters
- query loop “inherit query from template” prevents setting sort order