работа Cron каждые 5 минут WordPress
// You can create new schedule times via cron_schedules:
function my_cron_schedules($schedules){
if(!isset($schedules["5min"])){
$schedules["5min"] = array(
'interval' => 5*60,
'display' => __('Once every 5 minutes'));
}
if(!isset($schedules["30min"])){
$schedules["30min"] = array(
'interval' => 30*60,
'display' => __('Once every 30 minutes'));
}
return $schedules;
}
add_filter('cron_schedules','my_cron_schedules');
//Now you can schedule your function:
add_action( 'sw_cron_hook', 'my_cron_schedules' );
if ( ! wp_next_scheduled( 'sw_cron_hook' ) ) {
wp_schedule_event( time(), '5min', 'sw_cron_hook' );
}
Strange Squirrel