Hi team,
I’m encountering some inconsistent behavior with the Meta Query in Query Loop.
I have an ACF Date Time Picker field and I’m trying to build a query for upcoming events. I’ve tested two different no-code approaches with unexpected results.
1. The Timestamp Method (Fails in Meta Query, but works in Conditions)
This seems to be the recommended approach.
-
ACF Setup: Date Time Picker field (event_date) with the return format set to U (timestamp).
-
Meta Query Setup:
-
Meta key: event_date
-
Compare: >=
-
Type: NUMERIC
-
Meta value: {current_date:timestamp}
-
Result: The query returns zero posts.
The strange part: The dynamic tag {current_date:timestamp} itself is working correctly. If I use the exact same values in the Conditions settings (e.g., {acf_event_date} > {current_date:timestamp}), the condition evaluates perfectly. This suggests the dynamic tag is correct, but the Meta Query UI might not be processing it properly.
2. The Numeric String Method (Works for Ymd, but fails for YmdHi)
As a workaround, I tried using a numeric date string.
-
ACF Setup: Return format set to Ymd (e.g., 20251112).
- Result: This works perfectly in the Meta Query when compared against {current_date:Ymd}.
-
ACF Setup: Return format set to YmdHi (e.g., 202511121000) to include time.
- Result: This fails. The query ignores the filter and returns all posts.
This second test makes me suspect there might be a limitation on the size of the number (perhaps an integer overflow issue?) that the Meta Query UI can handle when the Type is set to NUMERIC.
Thanks for any insights!