The docs are a little vague in this area, but it should be possible to define your ordering value more succinctly:
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 5,
'category__in' => $postCategories,
'meta_query' => array(
array(
'key' => 'ordering_date',
'value' => date("Y-m-d H:i:s"),
'compare' => '>=',
'type' => 'DATETIME',
),
),
'order' => 'ASC',
'orderby' => 'meta_value_datetime',
'meta_key' => 'ordering_date',
);
Related Posts:
- Meta_query compare operator explanation
- Nested meta_query with multiple relation keys
- meta_query ‘compare’ => ‘IN’ not working
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query with checkbox meta_query
- ACF Relationship Field Search Filtering [closed]
- Query Multiple Post types each with own meta query
- Execute a large WP_Query with many “AND” Meta_Queries?
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Meta Query with date and time on the same Day before given time
- How to grab metabox value in wp_query meta_query key
- Is “orderby” in WP Meta Query conflicting with Meta Query?
- How can I create a WP_Query that returns posts where one meta_value
- WP Meta Query for some meta (array) values
- Sort users by meta_value_num
- meta_query with array as value
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- Using WP Query to search within ALL keys in meta query
- WP Query – Get WooCommerce Products with variation that is in stock
- Meta_query with or without value
- WP_Query meta_query >= date
- wp_query not searching with apostrophe
- Add condition of user capability in WP_query
- Custom query based on meta key – Reduce three states to two in results?
- How to make Meta Query case sensitive?
- Performance when getting post meta for post retrieved by meta value
- Adding an array from a query string to a WP meta_query
- Any number in meta key (wp query)
- Query by multiple meta elements not seeming to work – wordpress is timing out
- How to display multiple custom fields with the same meta_key in an ascending order?
- Meta_query with multiple keys and multiple values
- Is it a good idea to improve meta query performance by adding tax query?
- Modify wp-query and sort by post meta key
- Tax query AND/OR meta query [duplicate]
- Orderby listing issue
- Help ordering Post loop by two meta values
- Make meta query treat meta_value as 1 or 0
- meta queries do ‘either/or’ checks
- Is this meta query problematic?
- Selecting posts with a given meta value for a meta key
- Appending to existing WP_Query’s meta_query if exists
- Get every post with value in meta key
- get_page meta query not working, maybe a bug?
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Custom query filter by ACF date custom field
- Query by date from custom field
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Nested array issue in meta_query
- Error in meta_query not get result
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- How to get current page nearest parent id?
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- Sort posts using multiple custom fields and menu_order in single query?
- Order (by ASC) posts with meta_key so posts without values are last
- Search filter between promo and exact price
- meta_query – check for multiple meta values in key which holds an array of values
- Woocommerce Get Orders By Meta Value
- WordPress Meta Query Null Values Order
- show most viewed post
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- WP_User_Query Orderby Not Working
- Why can my filter query SOME metadata but not other metadata?
- Getting posts by custom field value
- WP_Query on custom key and value
- WordPress Query optimaization for slow query
- Get posts having meta value between two numbers
- wordpress multiple meta value query is not working
- Strange results from WP_Query
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Pre get posts sort by meta key returns no results if meta key does not exist
- Sorting with meta_query and multiple, optional meta keys
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- WP Query for Multiple Post Types
- Query by meta value (add a dropdown of all values)
- Meta query doesn’t remove placeholder escape before query
- Order Posts By Custom Field That is an array of objects
- Orderby query does not work for custom fields even with meta query
- Query custom meta value – post view and date meta
- make query more simplest and in one query
- WP_Query – show posts where meta value and user_email match
- WP_Query returns empty if meta_query has more than 7 values
- WP_Query using meta_query with LIKE doesn’t return what it should
- Use not custom fields in get_posts() meta_query?
- Compare meta key separation
- WordPress meta_query not working
- Using orderby with 2 meta keys
- Passing conditional arrays to WP_Query() [closed]
- WordPress Query Default Order if Meta Values Same?
- Including ‘cat’ => $cat breaks meta_query
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Wp query by 2 meta field – check if they exists / have value
- Get all user with both meta_value
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- How to get all post_id and meta_value using meta_key in wp_postmeta table
- Get posts using multiple values from ACF checkbox as meta query wordpress
- WP Query – Show custom posts only if user contain some user meta
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- Custom query with custom filtering returning incorrect results
- WP Query returning all posts when Meta_query is null