I formed this query based on this answer.
I would appear this is no longer the way to do it… I reformatted the query to look like this:
query_posts(
array(
'post_type' => 'events',
'showposts' => -1,
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => '_ecmb_datetime',
'value' => strtotime('today midnight'),
'compare' => '>='
),
array(
'key' => '_ecmb_datetime_end',
'value' => strtotime('today midnight'),
'compare' => '>='
)
)
)
);
Which seems to have solved the problem! If anyone has any other suggestions please feel free to share 🙂
Related Posts:
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- WP Query for Multiple Post Types
- Multiple meta_query not working
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- compare for multiple meta values for same key in wp_query
- Order Posts By Custom Field That is an array of objects
- datetime picker, timestamps and meta queries
- meta_query is not allowing to show posts when querying multiple arguments in a WP_Query
- WP_Query with meta_query won’t orderby
- WP Query Meta Query
- meta_query only check if both value are set
- Speed up WP_query with meta comparing dates
- Meta Query if Values Don’t Exist
- Orderby query does not work for custom fields even with meta query
- Get posts meta_query by repater field
- Query 3 meta_key and orderby
- wp_query sorting – one specific meta_key value at last and then sort by create date
- Query custom meta value – post view and date meta
- What is the best way to reset a search on a meta_key / meta_value?
- Saving custom fields for WP_Query to retrieve
- Slow query when selecting with large meta query or post__in
- How can I modify standard search query to include also ACF custom fields values?
- make query more simplest and in one query
- Custom WP_query and integrating into theme file
- How to show all the associated posts with specific date of data metabox?
- WP_Query – show posts where meta value and user_email match
- WP Meta Query at depth 2
- Best way to Order Post in Home without a plugin
- WP_Query returns empty if meta_query has more than 7 values
- Is it possible to search for a string in posts OR postmeta?
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- meta_query not working with the_content()
- WP_Query using meta_query with LIKE doesn’t return what it should
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Use not custom fields in get_posts() meta_query?
- Filter posts/pages by user_role array
- WP_Query with MetaQuery issue
- WP_Query Posts by Metadata from Option Tree
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Compare meta key separation
- WordPress meta_query not working
- Using orderby with 2 meta keys
- Is there any difference between below WP_Query code snippets?
- Get closest event where meta_key field is an array
- WP_Query with meta_value_num and meta_query not paged correctly
- Orderby Meta Value and Query from Meta Query
- Return a single custom post from multiple meta queries
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Set right order for query that returns posts based on two custom fields
- Sorting: custom query with orderby meta_value_num THEN by title
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- Passing conditional arrays to WP_Query() [closed]
- query post based on comparison
- WordPress Query Default Order if Meta Values Same?
- Sort Posts with custom meta key by default which is currently set as optional
- Meta_query weird behaviour
- Why is WP_Query’s meta_query not filtering results?
- Including ‘cat’ => $cat breaks meta_query
- meta_query compare not doing what I want it to do
- Looking for a way to exclude frontpage and nav menu from query filter
- WP_Query with several meta_query-statements and order by meta_value
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Creating Custom Query
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- Can’t figure out query logic
- WP_Query orderby not working on custom post_type
- Wp query by 2 meta field – check if they exists / have value
- meta_query in wp_query not working as expected
- 294 Queries on Mainpage of WordPress
- Get posts by meta value except one post [closed]
- Get all user with both meta_value
- WP_Query by meta key not returning any posts
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- WordPress extremely slow when using get_posts with multiple meta_query relations
- How do I have multiple metaqueries inside one wordpress query
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- WP query with multiple custom meta not respecting orderby
- Get posts using multiple values from ACF checkbox as meta query wordpress
- WP Query – Show custom posts only if user contain some user meta
- How do I subquery with custom meta fields?
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- Use meta query only 3 or more results?
- Showing Counts on Comment List with Custom Query
- Custom query with custom filtering returning incorrect results
- WP Query returning all posts when Meta_query is null
- Display only posts with thumbnails
- Use value from meta key array for use in WP_Query
- WordPress – Optimize the Meta Query for 3 meta keys at a time
- Passing a variable containing a comma separated list of values in a meta-query
- Complicated `orderby` based on text in custom field
- meta_query post_date not returning results
- WP Query: orderby with one meta key, but multiple values
- How to use meta_query to retrieve posts from multiple custom post type
- How to get products with the same custom attribute like ean code
- WP_Query filtering in ACF field containing dates
- Multiple meta value orderby clauses in a WP_Query
- WP_Query: how to sort all posts by date when one category has a custom “date” field?
- get_meta_sql hook is not firing
- Post Query with Meta Query no longer working