as_unschedule_all_actions()
Cancel all occurrences of a scheduled action.
No Hooks.
Returns
null. Nothing (null).
Usage
as_unschedule_all_actions( $hook, $args, $group );
- $hook(string) (required)
- The hook that the job will trigger.
- $args(array)
- Args that would have been passed to the job.
Default:array() - $group(string)
- The group the job is assigned to.
Default:''
as_unschedule_all_actions() as unschedule all actions code WC 10.5.0
function as_unschedule_all_actions( $hook, $args = array(), $group = '' ) {
if ( ! ActionScheduler::is_initialized( __FUNCTION__ ) ) {
return;
}
if ( empty( $args ) ) {
if ( ! empty( $hook ) && empty( $group ) ) {
ActionScheduler_Store::instance()->cancel_actions_by_hook( $hook );
return;
}
if ( ! empty( $group ) && empty( $hook ) ) {
ActionScheduler_Store::instance()->cancel_actions_by_group( $group );
return;
}
}
do {
$unscheduled_action = as_unschedule_action( $hook, $args, $group );
} while ( ! empty( $unscheduled_action ) );
}