You need something like the following:
$args = array(
'post_type' => 'events',
'posts_per_page' => 1,
'meta_query' => array(
'meta_key' => 'event_start_date',
'type' => 'DATETIME', // You can also try changing it to TIME or DATE if it doesn't work
'meta_value' => date( "Y-m-d" ),
'meta_compare' => '>',
),
'order' => 'ASC'
);
Related Posts:
- order by numeric value for meta value
- numberposts? showposts? posts_per_page?
- $GLOBALS[‘wp_the_query’] vs global $wp_query
- Some doubts about how the main query and the custom query works in this custom theme?
- How to query posts based on lat-lng coordinate as post meta?
- How to query only for products with status “in stock” in WooCommerce? [closed]
- WP_Query displaying ALL posts
- Does WordPress sanitize arguments to WP_Query?
- How to trigger 404 for custom query var?
- How do I create my own nested meta_query using posts_where / posts_join?
- Highlighting Sub topic in a post?
- Best Practice For Querying Grandchildren?
- How to combine tax_query and date_query in WordPress
- How to get any tag ID
- WP_Query with many meta_query arguments taking a long time to load
- Slow speed and high CPU usage for my code. How to improve it?
- Multiple queries on Home Page – page load/site speed issue
- wp_query display posts from same category of the post
- Targeting specific pages in the loop
- WordPress custom archive page
- How to prevent queried posts from being added to cache?
- Order posts by meta value and Date
- Include Sticky Posts in Page Post Count for custom query
- Query sticky posts with thumbnails
- Show all parents and children in custom post type in right order
- Why is this coming back as null? Thats wrong. There is one post
- Retrieve featured image (thumbnail) url from multiple posts with one query
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Can you order posts from wp_query by two custom meta fields?
- Retreaving all images attached to current post
- wp_query() get_col error
- Pagination working everywhere but the index page
- How to select posts from one category but exclude posts in another category?
- Exclude admin from WP_Query Contributors
- WPDB query – decrypting DB data
- Storing query variable and then using wp_reset_query
- exclude posts with a specific custom field and value
- Redirect page when URL parameter not set
- list pages using page.php and NOT page-{slug}.php
- Moving the array pointer inside a WP_Query while loop
- Help with WP_Query – Too many mySQL queries
- WordPress Pagination changes my template
- wp_query ignoring custom post_status
- Query posts(CPT, pages , hierarchical) by Ancestor ID
- Input check to custom post type query
- Get a list of posts with associated meta_value
- Show all data in database table and make it into an interactive table
- Combine two queries into one to use in loop
- database query with more than a couple meta hangs and doesn’t complete
- How to filter a query by date in a shortcode?
- Query post with meta value in set of values
- get_template_part causes 500 error
- Finding WordPress Posts assigned to multiple categories
- Does meta_value (array) work with ‘orderby’?
- Shortcode for custom query not returning results when attributes are added
- wp_query is showing posts from other categories
- Get posts in taxonomy randomly
- Page navigation doesn’t seem to work when I add offset?
- is_404() – where does this get set?
- Max Posts and Memory Limit
- WordPress | WP_Query does not return anything with s=a
- WP_Query Pagination
- WP_Query orderby
- Using Ajax and WP_Query to load more posts on category page fails
- I have problems with the search query using multiple post types
- How to check if logged in user have pending custom post?
- How can I re-query post_type and rewrite the url?
- Different query result on local and server
- meta_query compare > not working
- How can I show only last year posts in wordpress archive?
- WP_Query about meta_key and its array value
- Related Post by Tags Code
- I can’t get post based on its postmeta value and key
- Change database image location for transportability
- Combine Tax Archive and Meta_Query in WP_Query
- Get posts by birthday
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Paginate nested query of child posts
- 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
- Optimising amount of calls to custom fields
- Issue in If else condition [closed]
- Pagination not working with WP_QUERY
- Get Current CPT taxonomy category in shortcode
- Custom Content Slider stop duplicate
- Extract video content from post to display on front page
- Sort Posts with custom meta key by default which is currently set as optional
- wp_query pagination links producing 404
- Pagination problem with multiple loops on the same page
- Carousel slider with WP_Query to show 3 posts on each slide
- how to use transient method?
- WP_Query – meta fields numeric
- How to query posts from single post format on Genesis framework
- How to replecate the _fields parameter in custom REST api endpoint
- Pagination only showed when no category is set in wp_query
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2
- Prevent URL Parameter Affecting other WP Query
- Sort by multiple columns using get_posts
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)