我需要查询日期:-2020-01-06如果此日期(2020-01-06)存在于发布元表的_ from字段中。_ form字段采用时间戳格式,例如1578304800。
这就是我正在尝试做的。
$theBookingTime = strtotime( '2020-01-06' );
$events_query = new WP_Query(
array(
'post_type' => array('yith_booking', 'post'),
'meta_query' => array(
array( 'key' => '_from',
'value' => date('c', $theBookingTime),
'compare' => '=',
'type' => 'DATETIME',
)
)
));
尝试下面的代码,让我知道。
将类型更改为数字。
$theBookingTime = strtotime( '2020-01-06' );
$events_query = new WP_Query(
array(
'post_type' => 'yith_booking',
'meta_query' => array(
array(
'key' => '_from',
'value' => date($theBookingTime),
'compare' => '=',
'type' => 'NUMERIC',
)
)
)
);