Home › Forums › General Issues › Query not running as expected › Reply To: Query not running as expected
Ok, so it would appear this was due to the Return Format I had setup prior to the query being run.
I’m still having problems understanding the compare, especially when the type is set to “DATE”, however.
If I set the Return Format for the ACF to “Ymd” then it breaks the release date set on the individual films, whereas if I use the Custom value of “U” and run my query then it displays correctly (I then have to change the formatting later so that it displays in a “d/m/Y” format. For example, one film changes the set release date from 21/07/2028 to 23/08/1970?
$dateToday = date('Ymd');
$comingSoonFilms = new WP_Query(array(
'post_type' => 'film',
'posts_per_page' => -1,
'order' => 'ASC',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'film_releasedate',
'value' => $dateToday,
'type' => 'DATE',
'compare' => '>',
),
array(
'key' => 'film_active',
'value' => '1',
),
)
));
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.