尝试为WP Cron设置自定义计划,知道它们使用间隔,甚至可以为每个月的第一个月设置Cron作业吗?以及每十五天。这就是我目前的情况:
private function cron_schedules( $schedules ) {
$midnight = strtotime( "midnight", current_time( \'timestamp\' ) );
$first = strtotime( \'first day of this month\', $midnight );
$fifteenth = $first + (7 * 24 * 60 * 60) * 2;
$schedules[\'1st\'] = array(
\'interval\' => $first,
\'display\' => __(\'1st of every month\'),
);
$schedules[\'15th\'] = array(
\'interval\' => $fifteenth,
\'display\' => __(\'15th of every month\'),
);
$schedules[\'weekly\'] = array(
\'interval\' => ( 7 * 24 * 60 * 60 ),
\'display\' => __(\'Weekly\'),
);
$schedules[\'biweekly\'] = array(
\'interval\' => ( 7 * 24 * 60 * 60 ) * 2,
\'display\' => __(\'Biweekly\'),
);
return $schedules;
}