稍微更改一下您的查询:
$todays_date = time();
$args = array (\'post_type\' => \'tasks\',
\'meta_key\' => \'\'end_date,
\'meta_compare\' => \'<\',
\'meta_value\' => $todays_date,
\'orderby\' => \'meta_value\'
);
$tasks = get_posts($args);
然后,对于每一篇帖子,获取start\\u date meta并与$today进行比较,例如:
$today = strtotime($today);
foreach ($tasks as $task_post){
$start = strtotime(get_post_meta($task_post->ID, start_date, true));
if ($today > $start){
//to task stuff here
}
}
希望这有帮助。