admin管理员组文章数量:1336632
I have dates stored in the format d-m-Y, and i want to display any posts that are in the past, before today.
$args = array (
'post_type'=>'property',
'post_status'=>'publish',
'posts_per_page'=> 8,
'paged'=> $paged,
'meta_query' => array(
'key' => 'auction_date',
'value' => date( 'd-m-Y'),
'compare' => '<',
'type' => 'DATE'
),
);
This doesn't seem to work and i can't figure out why. Any suggestions would be much appreciated.
I have dates stored in the format d-m-Y, and i want to display any posts that are in the past, before today.
$args = array (
'post_type'=>'property',
'post_status'=>'publish',
'posts_per_page'=> 8,
'paged'=> $paged,
'meta_query' => array(
'key' => 'auction_date',
'value' => date( 'd-m-Y'),
'compare' => '<',
'type' => 'DATE'
),
);
This doesn't seem to work and i can't figure out why. Any suggestions would be much appreciated.
Share Improve this question asked Jan 30, 2020 at 11:12 reigns1989reigns1989 171 silver badge6 bronze badges1 Answer
Reset to default 0ACF stores it's dates in Ymd format, this is why i couldn't compare.
Make sure your date is in Ymd format when you compare it against an ACF datefield.
本文标签: wp queryComparing Meta Field date in WPQuery using MetaQuery
版权声明:本文标题:wp query - Comparing Meta Field date in WPQuery using Meta_Query? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742412991a2470159.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论