Home › Forums › General Issues › A point on Date fields in WP_Query › Reply To: A point on Date fields in WP_Query
Hi,
I received an email that tell that the user Feyfey answered my thread, however for a weird reason, I can’t see the post here.
For my first question, I presume it was ok to said that ACF finally asigned an empty string (and not a null value) in the meta key. Maybe it happens when entering and removing a date manually in the field, then save the post. However I haven’t been able to make work the “NOT EXISTS” comparasion yet.
For my second one, here’s finally a group of arguments which worked for me :
$date_limit = date('Y-m-d', strtotime("-3 days"));
$args = array(
'post_type' => 'vehicle',
'meta_key' => 'date_sell',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'date_sell',
'compare' => '>=',
'value' => $date_limit,
'type' => 'DATE'
),
array(
'key' => 'date_sell',
'compare' => '=',
'value' => ''
)
)
);
So with a Date type and ‘Y-m-d’ format.
Hope it’ll help.
Nox
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.