meta query - meta_query check multiple date formats

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 t

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'
            )
        )
)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744710050a4589288.html

相关推荐

  • meta query - meta_query check multiple date formats

    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 t

    1天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信