時間範囲に基づいて発生する wp_cron イベントを実行しようとしています。しかし、一定期間未満の間隔を設定することはできますが、範囲内には設定できません。シナリオは、$wp_cron_start
が正午より前の時刻に設定されている場合$wp_cron_start
で、 が現在の時刻よりも大きい場合はその日に起動できます。これらの条件が満たされない場合は、wp_cron を翌日に実行するように設定します。最初の条件が機能しない問題。シナリオについて言う$wp_cron_start = "08:00"
。
$wp_cron_start = "08:00";
if ($wp_cron_start < date('12:00') && $wp_cron_start > date("H:i")) {
if(!wp_next_scheduled('cron_hook')) {
wp_schedule_event(strtotime($wp_cron_start), 'daily', 'cron_hook');
}
} else {
$cron_date_start = date('D H:i:s', strtotime('+1 Weekday' . $this->options['bbna_morning_button_end_time']));
wp_schedule_event(strtotime($cron_date_start), 'daily', 'cron_hook');
}
これは、翌日の wp_cron のみを設定します。そして、それはまだ発火しません。