Cron Scheduler的Cron作业无法正常工作-Wordpress

时间:2018-09-27 04:36:21

标签: php wordpress cron-task

这是我用来计划CRON作业的代码。

add_filter( 'cron_schedules', 'isa_add_every_ten_seconds' );
function isa_add_every_ten_seconds( $schedules ) {
    $schedules['every_ten_seconds'] = array(
            'interval'  => 10,
            'display'   => __( 'Every 10 seconds', 'sometext' )
    );
    return $schedules;
}

// Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'isa_add_every_ten_seconds' ) ) {
    wp_schedule_event( time(), 'every_ten_seconds', 'isa_add_every_ten_seconds' );
}

// Hook into that action that'll fire every three minutes
add_action( 'isa_add_every_ten_seconds', 'every_ten_seconds_function_func' );
function every_ten_seconds_function_func() {
    update_page();
}

我已经在本地服务器和真实服务器中进行了检查。不用找了。代码有什么问题?

0 个答案:

没有答案