admin管理员组文章数量:1390775
I am trying to query a custom post type that has a meta value (DATE) that are equal or greater than today. My issue is that some posts have the date stored in the "Ymd" format and others have "Y-m-dTg:i a".
This is what I currently have. It currently isn't ordering properly.
'posts_per_page' => -1,
'orderby' => 'meta_value_num',
'order' => 'ASC',
'post_type' => 'funeral',
'post_status' => 'publish',
'meta_query' => array(
array(
'relation' => 'OR',
array(
'key' => 'service_date',
'value' => date('Ymd'),
'compare' => '>=',
'type' => 'DATE'
),
array(
'key' => 'service_date',
'value' => date('Y-m-dTg:i a'),
'compare' => '>=',
'type' => 'DATE'
)
)
)
本文标签: meta querymetaquery check multiple date formats
版权声明:本文标题:meta query - meta_query check multiple date formats 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744710049a2621074.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论