Commit 746cc6b7 authored by Erick Hitter's avatar Erick Hitter

Overlooked the CLI case for enforcing scheduling of Internal Events

parent 19283be4
......@@ -40,8 +40,13 @@ class Internal_Events extends Singleton {
$this->prepare_internal_events_schedules();
// Register hooks.
add_action( 'admin_init', array( $this, 'schedule_internal_events' ) );
add_action( 'rest_api_init', array( $this, 'schedule_internal_events' ) );
if ( defined( 'WP_CLI' ) && \WP_CLI ) {
add_action( 'wp_loaded', array( $this, 'schedule_internal_events' ) );
} else {
add_action( 'admin_init', array( $this, 'schedule_internal_events' ) );
add_action( 'rest_api_init', array( $this, 'schedule_internal_events' ) );
}
add_filter( 'cron_schedules', array( $this, 'register_internal_events_schedules' ) );
foreach ( $this->internal_events as $internal_event ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment