, - cronhour, . , (.. / (, , ) - )?
, . , , , , .
, , . , , , , .
:
<?php
add_action('wp','prefix_setup_schedule');
function prefix_setup_schedule() {
if (!wp_next_scheduled('prefix_hourly_event')){
wp_schedule_event(time(), 'hourly', 'prefix_hourly_event');
}
if (!wp_next_scheduled('daily_prefix_hourly_event')){
wp_schedule_event(time(), 'wpo_daily', 'daily_prefix_hourly_event');
}
}
add_action('prefix_hourly_event','filter_mem');
$t = time();
$hour = date('G');
if(get_option('cronhour') != null) {
$hcron = (int)get_option('cronhour');
if($hcron > 0 && $hcron <= 23){
if($hour < $hcron){
$on = mktime($hcron, 0, 0, date('m'), date('d'), date('Y'));
}else{
$on = mktime($hcron, 0, 0, date('m'), date('d')+1, date('Y'));
}
}else{
$hcron = 0;
if($hour < $hcron){
$on = mktime($hcron, 0, 0, date('m'), date('d'), date('Y'));
}else{
$on = mktime($hcron, 0, 0, date('m'), date('d')+1, date('Y'));
}
}
} else {
$hcron = 0;
if($hour < $hcron){
$on = mktime($hcron, 0, 0, date('m'), date('d'), date('Y'));
}else{
$on = mktime($hcron, 0, 0, date('m'), date('d')+1, date('Y'));
}
}
if ($t>=$on){
add_action('daily_prefix_hourly_event', 'filter_temp');
}
, , ( cronhour , ), , cronhour , "" cronhour (- , ).
add_action('prefix_hourly_event','filter_mem'); ( , WP , ).
if, , date('G') 0, - , , , .
, " [] / , , "; , WordPress - , , .
WP , , , , , , , ( , , /, , WP, ).
, , , - , , - .