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 with meta values as serialize arrays
- Use REGEXP in WP_Query meta_query key
- compare meta_query in get_posts arguments
- Display products from specific category in shop page
- How to Compare Two Meta Fields
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- Getting attachments by meta value
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- Query by meta_key and order by meta_value_num return orderby date
- WP_Query not working as expected for attachments and custom meta_query
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- Wp_query order by multiple custom fields?
- WordPress altering my custom query, How to fix it?
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Order by meta_key in custom post type doesn’t affect the query
- How to create/modfiy WP_Query to search in post title OR custom field?
- Order By Multiple Meta Fields
- Advanced WP Query hogs the SQL server
- Query sticky posts with thumbnails
- How to get user_id from wordpress database inside ajax function?
- Multiple meta queries but arrange by specific meta value order
- Order Posts by meta value AND published date
- WP_Query with multiple meta fields filter?
- How to combine meta_query and post__in in WP_Query
- What format does the meta_query TIME type require?
- How to orderby meta_value_num with dollar ($) sign
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- pre_get_posts order by not working
- WP_Query filter and order by meta ordering by wrong joined table
- WP_Query last five posts, simply ordered by meta_value
- Meta Query Array Error 500
- What is the random string I am seeing when I use get_query_var?
- How to orderby multiple meta fields if some fields are empty
- Fetch Record based on meta key dates
- meta_query in WP_Query value is not accepting array
- Order by meta value (numeric value lower to higher)
- Changing sort order for presentation by Jetpack infinite scroll
- meta_query not working as expected
- get posts by meta_key from inside key of post meta
- Help optimizing slow WP_Query with meta_query
- meta_value_num not ordering all items
- Meta Queries – should nesting work after WP 4.1?
- Filter and Order by Multiple Custom Meta Values
- Meta Query relation “AND” then set array accordingly
- 2 weeks ago from meta query meta value
- Make meta query treat meta_value as 1 or 0
- Is this meta query problematic?
- Selecting posts with a given meta value for a meta key
- Meta query compare for ID’s greater than specific ID
- 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
- WordPress Meta Query Null Values Order
- show most viewed post
- Searching for a specific month in a metadata saved as Timestamp (Wp_Query)
- Why can my filter query SOME metadata but not other metadata?
- Getting posts by custom field value
- WP_Query on custom key and value
- 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)
- Order Posts By Custom Field That is an array of objects
- Orderby query does not work for custom fields even with meta query
- make query more simplest and in one query
- Best way to Order Post in Home without a plugin
- WP_Query returns empty if meta_query has more than 7 values
- 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?
- 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
- 294 Queries on Mainpage of WordPress
- Get all user with both meta_value
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Showing Counts on Comment List with Custom Query
- Use value from meta key array for use in WP_Query
- WordPress – Optimize the Meta Query for 3 meta keys at a time