ActionScheduler_QueueRunner::init() –

You appear to be a bot. Output may be restricted

Description

Usage

ActionScheduler_QueueRunner::init();

Parameters

Returns

void

Source

File name: woocommerce/packages/action-scheduler/classes/ActionScheduler_QueueRunner.php


Lines:

1 to 21 of 21
  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();
  }
 

 View on GitHub View on Trac