Answer the question
In order to leave comments, you need to log in
How to filter by date using ACF?
Greetings. I'm trying to filter posts by date, you need to get posts at least for a certain date first. Here, I wrote the code, but the result is that there are no posts, although there is a post for this value.
Question: what am I doing wrong?
$the_query = new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => -1,
'orderby' => 'calendar_date',
'order' => 'ASC',
'cat' => '26',
'meta_query' => array(
array(
'key' => 'field_5b48f1dbc5529',
'value' => '16.07.2018'
)
)
));
while ( $the_query->have_posts() ) : $the_query->the_post();
Answer the question
In order to leave comments, you need to log in
Try not through the meta_query array, but through the parameters:
'meta_key' => '',
'meta_value' =>'',
https://wp-kama.ru/function/get_posts
and if a date is selected, it must also be in the date format .
https://codex.wordpress.org/Class_Reference/WP_Met...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question