action_scheduler_ensure_recurring_actions action-hookWC 3.9.3

Fires to allow extensions to verify and ensure their recurring actions are scheduled.

This action is scheduled to trigger once every 24 hrs for the purpose of having 3rd party plugins verify that any previously scheduled recurring actions are still scheduled. Because recurring actions could stop getting rescheduled by default due to excessive failures, database issues, or other interruptions, extensions can use this hook to check for the existence of their recurring actions and reschedule them if necessary.

Example usage:

add_action(action_scheduler_ensure_recurring_actions, function() {

// Check if the recurring action is scheduled, and reschedule if missing.
if ( ! as_has_scheduled_action('my_recurring_action') ) {
	as_schedule_recurring_action( time(), HOUR_IN_SECONDS, 'my_recurring_action' );
}

});

Usage

add_action( 'action_scheduler_ensure_recurring_actions', 'wp_kama_action_scheduler_ensure_recurring_actions_action' );

/**
 * Function for `action_scheduler_ensure_recurring_actions` action-hook.
 * 
 * @return void
 */
function wp_kama_action_scheduler_ensure_recurring_actions_action(){

	// action...
}

Changelog

Since 3.9.3 Introduced.

Where the hook is called

ActionScheduler_RecurringActionScheduler::run_recurring_scheduler_hook()
action_scheduler_ensure_recurring_actions

Where the hook is used in WooCommerce

woocommerce/includes/class-woocommerce.php 329
add_action( 'action_scheduler_ensure_recurring_actions', array( $this, 'register_recurring_actions' ) );
woocommerce/src/Blocks/Patterns/PTKPatternsStore.php 54
add_action( 'action_scheduler_ensure_recurring_actions', array( $this, 'ensure_recurring_fetch_patterns_if_enabled' ) );
woocommerce/src/Caches/OrderCountCacheService.php 53
add_action( 'action_scheduler_ensure_recurring_actions', array( $this, 'schedule_background_actions' ) );