admin管理员组文章数量:1122846
I'm working on a query where I have a few conditions, one of them involving post_date. However, whenever I try to write my query, post_date doesn't return any matches. If I comment that part out, it will return matches (but not quite to where I need). If I only have the post_date query uncommented, it returns 0 results.
Is anyone able to help point me in the right direction?
$date_seven = date('Y-m-d H:i:s', strtotime('-7 days'));
'meta_query' => array(
'relation' => 'AND',
// show posts where location is US
array(
'key' => 'monitor_settings_location',
'value' => 'US',
'compare' => 'LIKE'
),
array(
'relation' => 'OR',
// if end date is empty, show for 7 days after publish date
array(
'relation' => 'AND',
array(
'key' => 'monitor_settings_end_date',
'value' => '',
),
array(
'key' => 'post_date',
'value' => $date_seven,
'compare' => '>=',
'value' => 'DATETIME'
)
),
// if end date exists, show until that date
array(
'key' => 'monitor_settings_end_date',
'value' => $date_now,
'compare' => '>='
'value' => 'DATETIME'
)
)
)
Using var_dump
on the results with the post_date aspect commented out gives me public 'post_date' => string '2024-06-28 12:29:52' (length=19)
本文标签: wp querymetaquery postdate not returning results
版权声明:本文标题:wp query - meta_query post_date not returning results 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301956a1931358.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论