I believe the meta_query part should be a nested array, so your query should be like this:
$query = new WP_Query(
'post_type' => 'post',
'orderby' => 'meta_value',
'meta_key' => 'ENDS',
'order' => 'ASC',
'posts_per_page' => -1,
'meta_query' => array(
array (
'key' => 'ENDS',
'value' => date('Y-m-d H:i:s'), // now
'compare' => '>=',
'type' => 'DATETIME',
),
),
);
Note that I also added the ‘type’ => ‘DATETIME’ to the meta_query inner array.
Hope this helps.
Related Posts:
- 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
- get_children() Archive Template
- Function the_posts_pagination() not compatible with WP_Query arguments
- How to separate two columns from one content on a page template?
- How can I use arrays and a foreach to generate many lists with WP_Query?
- How to use custom page for all posts with custom url, call another directory?
- Custom wp_query inside a conditional stament inside a template part doesn’t work: why?
- display ACF repater field in archive page
- Populate select list with meta values from all posts of a Custom Post Type
- Prevent Duplicate Post Counted by Query
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- Duplice post with standard WP loop – fixed by using query_posts() instead
- WP_Query breaking the loop in a nested loop
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Can I alter the main loop to ‘orderby’ a custom callback?
- show most viewed post
- How do I stop the same post showing multiple times in a archive?
- Check the stored / cached WP_Query with transients on post change
- New template file does not load category-specific post
- Show a message if there are no active posts in category
- Show custom content when loop or wp query reaches specific time?
- Bootstrap grid while loop
- Related posts queries
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Get categories within specific term
- Avoid removing duplicate posts
- Loop through array of pages
- How to show specify category template for both parent and child category
- Pagination inside the blog page not working
- Custom query for custom post type not getting correct post ID
- Woocommerce featured products query no longer working
- how to get custom attachment url?
- Ajax buttons not working properly in WooCommerce when using wc_get_template_part
- How can I use WP_Query to sort ‘event’ custom post type by date?
- Query post with content only
- Problem with my loops
- Display posts side by side with custom query
- Custom Query Pagination not working on static front page
- WP_Query & Duplicate entries
- Regarding a custom loop and output HTML tags
- Repeat array inside array through while loop
- WordPress For Loop Prints Unwanted Extra Paragraph Element
- What’s causing an infinite loop?
- display the children of the post using the current page as the main parent
- Display 3 levels of categories on page
- update_post_meta() not updating
- Paging works correctly on local version, but not live?
- query all posts published by certain user id
- pages shortcode filtering by category
- the_post_thumbnail and multiple WP_Query
- I have 3 categories, i want to display on a loop the last 3 of every category
- Custom post type loop error: Trying to get property of non-object
- Second WP_Query loop shows data from main query
- Meta Query if Values Don’t Exist
- Get post Number with local loop and template
- How to order posts, that have already been filtered by custom taxonomy, by their category names?
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Why is my query not giving results?
- why default wordpress loop not working outside index.php
- how to show more than 1 post into three columns query
- WP_Query doesn’t works inside loop
- Problem with custom WP_Query and underlying pagination/posts_per_page
- Display three sequential posts on each page load, without repeating previous
- Calling a function with WP_Query only ever brings the first result
- View related categories in order of posts
- modifying the loop multiple times with arguments passed through ajax to wp_query
- WP_Query causing links to not work
- Continue loop after $queryObject
- query_posts() doesn’t seem to be called in my page
- Some doubts about how the main query and the custom query works in this custom theme?
- display post multiple times based on array of dates
- Retrieving category pages from subcategory returns empty sets
- How to make a wordpress loop file that displays posts based on certain conditions
- active link for most recent post on vertical tabs
- 2 Loops on one page – pagination of 2nd loop ignore array of excluded posts
- Pagination returns 404 after page 20
- Problems with WP_Query, Loop, a condition and Posts per Page
- Ordering Posts by parent category, name ascending
- WP_Query secondary query failing
- custom query – offset to pagination
- WP_query for posts with same post type AND same post category
- How to solve this script problem in theme directory?
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- WP_Query a custom field value bringing back 0 results
- Set Transient on CPT
- Issue in If else condition [closed]
- Create multiple sections for all categories and then queries all the posts for each of those categories
- Pagination not working with WP_QUERY
- Show posts in category
- Both WP_Query and get_posts returning 1 post
- Custom search (wp query by custom fields)
- Iterate through ID’s in loop
- Sorting is not working in WordPress WP_Query
- Add custom WP_Query after the first 3 posts
- Load 3 posts in flexslider slide [closed]
- Loop through multiple custom fields with increasing number
- WP_Query for attachments without duplicating post_parent and displaying tagged image
- Different number of posts showing in development vs production server
- Issue with WP_Query (need a array of selected ID’s)
- How do I display posts with specific value in a custom field into my loop?