Automattic\WooCommerce\Internal\BatchProcessing
BatchProcessingController::has_scheduled_action
Check for a pending or in-progress action, falling back to as_next_scheduled_action on Action Scheduler < 3.3.0. Returns false if Action Scheduler is not loaded at all.
Method of the class: BatchProcessingController{}
No Hooks.
Returns
bool. True if a matching action is scheduled.
Usage
// private - for code of main (parent) class only $result = $this->has_scheduled_action( $hook, ?array $args ): bool;
- $hook(string) (required)
- The hook of the action.
- ?array $args
- .
Default:null
BatchProcessingController::has_scheduled_action() BatchProcessingController::has scheduled action code WC 11.2.2
private function has_scheduled_action( string $hook, ?array $args = null ): bool {
foreach ( $this->scheduled_action_lookups as $function ) {
if ( function_exists( $function ) ) {
// `as_next_scheduled_action` returns a timestamp, or true for an in-progress action.
return (bool) $function( $hook, $args );
}
}
wc_doing_it_wrong( __METHOD__, 'Action Scheduler is not loaded, so scheduled actions cannot be checked.', '11.2.0' );
return false;
}