What is missing? One tiny detail… And it’s easy to overlook…
the_field('datum_event');
Prints the field using the format you’ve defined in field settings. But… It has nothing to do with how the value of that field is stored in DB. ACF uses YYYYMMDD
format when storing date values in DB. And WP_Query doesn’t use field format, since it looks directly in DB.
So you have to use other/raw format in your WP_Query:
$args = array(
'post_type' => 'agenda',
'meta_query' => array(
array(
'key' => 'datum_event',
'value' => '20190106',
'compare' => '>='
)
),
);
$loop = new WP_Query( $args );
Related Posts:
- ACF Relationship Field Search Filtering [closed]
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- meta_query with array as value
- Use meta_query to display events by date in custom field
- How to show recent and upcoming birthdays using meta_query
- Meta Query for specific months
- If two first numbers exist in wp_meta_query value
- ACF Date Based wp_query
- Custom query based on meta key – Reduce three states to two in results?
- What is the random string I am seeing when I use get_query_var?
- Any number in meta key (wp query)
- WP_Query with meta_query dosen’t return results
- Custom query filter by ACF date custom field
- Show single posts date, in a page of posts
- Using WP meta query to show custom post types by a start and finish date
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- Comparing Meta Field date in WPQuery using Meta_Query?
- WP_Query, ACF field and array
- Pre get posts sort by meta key returns no results if meta key does not exist
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Get posts meta_query by repater field
- How can I modify standard search query to include also ACF custom fields values?
- The sorting of posts by a meta_query with two keys fails while separated as single queries it works
- Get posts using multiple values from ACF checkbox as meta query wordpress
- How do I subquery with custom meta fields?
- Use value from meta key array for use in WP_Query
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Custom WP_Query order by post_meta and (author) user_meta
- WordPress Custom Query to show posts from last x years
- Using custom meta_query with relation not working as expected
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- What is an efficient way to query based on post_meta?
- How do I create my own nested meta_query using posts_where / posts_join?
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Exclude post on loop by multiple meta key value
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Order posts by meta value and Date
- Query sticky posts with thumbnails
- Order WP Query posts by custom order calculated from post meta values
- Meta query with order by another custom field
- How to query for custom field within Gutenberg block from outside of that post? [closed]
- Can an array be used as a meta_query value?
- Meta query with JSON value
- Get meta info related to current post
- Creating arguments from loop for WP_Query meta_query
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Get attachment by meta_key value
- Complex WP_Query order request: DESC by day, but then ASC by time
- Using meta_query with multiple keys and compare values
- Mysql query and order meta value
- Is it a good idea to improve meta query performance by adding tax query?
- meta_query BETWEEN, but the range is stored in the custom field
- Is it possible to set specific posts to show first in a query?
- Orderby listing issue
- Order ascending is ignored in meta query?
- database query with more than a couple meta hangs and doesn’t complete
- Make meta query treat meta_value as 1 or 0
- Sort by presence of thumbnail
- it’s possible make a WP_Query with math operations?
- Sorting search results with custom dropdown
- Expecting statement error from php loop using ACF plugin
- How to show list of posts with custom field value (a date) that are coming soon
- WP_Query meta compare must include ALL array values
- What’s missing in this wp_query and meta_query
- meta_query weird behaviour, static int will work, but not user data
- Excluding posts from search results page with meta query not working
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Trouble with serialized metadata
- meta_query order by date present -> future then show null
- Query for getting posts with their custom fields data in WordPress
- How to rearrange posts based on input field values added by WordPress “Advanced Custom Fields”
- Problem with my loops
- Sort posts on custom field AND after that sort on date?
- meta_query compare > not working
- Query string order by custom field
- meta_query is not allowing to show posts when querying multiple arguments in a WP_Query
- Get posts by birthday
- Saving custom fields for WP_Query to retrieve
- Is it possible to search for a string in posts OR postmeta?
- 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
- WP_Query within save_post doesn’t include the item that triggered the action?
- Issue in If else condition [closed]
- WP_Query with meta_value_num and meta_query not paged correctly
- Post Query not working after updating to 4.1
- Orderby Meta Value and Query from Meta Query
- Sort posts in dashboard using custom field; also include posts where field isn’t set
- Sort Posts with custom meta key by default which is currently set as optional
- WP_Query with several meta_query-statements and order by meta_value
- Output ACF field dynamicaly within a taxonomy loop [closed]
- WordPress extremely slow when using get_posts with multiple meta_query relations
- I want to place a post before all others from an ACF boleen field
- WP_Query sort by ACF date field (newest first) with blank dates first