ActionScheduler_QueueRunner::init()publicWC 1.0

Method of the class: ActionScheduler_QueueRunner{}

Hooks from the method

Return

null. Nothing (null).

Usage

$ActionScheduler_QueueRunner = new ActionScheduler_QueueRunner();
$ActionScheduler_QueueRunner->init();

ActionScheduler_QueueRunner::init() code WC 8.6.1

public function init() {

	add_filter( 'cron_schedules', array( self::instance(), 'add_wp_cron_schedule' ) );

	// Check for and remove any WP Cron hook scheduled by Action Scheduler < 3.0.0, which didn't include the $context param
	$next_timestamp = wp_next_scheduled( self::WP_CRON_HOOK );
	if ( $next_timestamp ) {
		wp_unschedule_event( $next_timestamp, self::WP_CRON_HOOK );
	}

	$cron_context = array( 'WP Cron' );

	if ( ! wp_next_scheduled( self::WP_CRON_HOOK, $cron_context ) ) {
		$schedule = apply_filters( 'action_scheduler_run_schedule', self::WP_CRON_SCHEDULE );
		wp_schedule_event( time(), $schedule, self::WP_CRON_HOOK, $cron_context );
	}

	add_action( self::WP_CRON_HOOK, array( self::instance(), 'run' ) );
	$this->hook_dispatch_async_request();
}