每 6 小时一次的 Wordpress cron 作业
Wordpress cron jon every 6 hours
我目前有一个 Cron 作业设置为每小时 运行。我实际上想每 6 小时将其更改为 运行。我找不到 "sixhourly" 设置。我错过了什么吗?
if (!wp_next_scheduled('retrySysProHook')) {
wp_schedule_event(time(), 'hourly', 'retrySysProHook');
}
https://developer.wordpress.org/reference/hooks/cron_schedules/
允许您设置自定义时间表。
https://wordpress.stackexchange.com/questions/179694/wp-schedule-event-every-day-at-specific-time
有这个例子:
function myprefix_custom_cron_schedule( $schedules ) {
$schedules['every_six_hours'] = array(
'interval' => 21600, // Every 6 hours
'display' => __( 'Every 6 hours' ),
);
return $schedules;
}
add_filter( 'cron_schedules', 'myprefix_custom_cron_schedule' );
我目前有一个 Cron 作业设置为每小时 运行。我实际上想每 6 小时将其更改为 运行。我找不到 "sixhourly" 设置。我错过了什么吗?
if (!wp_next_scheduled('retrySysProHook')) {
wp_schedule_event(time(), 'hourly', 'retrySysProHook');
}
https://developer.wordpress.org/reference/hooks/cron_schedules/
允许您设置自定义时间表。
https://wordpress.stackexchange.com/questions/179694/wp-schedule-event-every-day-at-specific-time
有这个例子:
function myprefix_custom_cron_schedule( $schedules ) {
$schedules['every_six_hours'] = array(
'interval' => 21600, // Every 6 hours
'display' => __( 'Every 6 hours' ),
);
return $schedules;
}
add_filter( 'cron_schedules', 'myprefix_custom_cron_schedule' );