如果自定义字段数组包含的日期在指定范围内,如何执行查询以返回帖子?下面的查询基本上是我想要的,但它不起作用。。。
// the income_dates array looks like this
// a:3:{i:0;s:10:"2014-02-01";i:1;s:10:"2014-03-01";i:2;s:10:"2014-03-29";}
$today = date("Y-m-d");
$date1 = date("Y-m-d", strtotime($today . "-1 Month"));
$date2 = date("Y-m-d", strtotime($today . "+1 Month"));
$args = array(
\'post_type\' => \'income\',
\'meta_query\' => array(
array(
\'key\' => \'income_dates\',
\'value\' => $date1,
\'type\' => \'date\',
\'compare\' => \'>\'
),
array(
\'key\' => \'income_dates\',
\'value\' => $date2,
\'type\' => \'date\',
\'compare\' => \'<\'
),
)
);