Action_Scheduler\WP_CLI\Action
Cancel_Command::cancel_single
Cancel single action.
Метод класса: Cancel_Command{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->cancel_single( $hook, $callback_args, $group );
- $hook(строка) (обязательный)
- The hook that the job will trigger.
- $callback_args(массив) (обязательный)
- Args that would have been passed to the job.
- $group(строка) (обязательный)
- The group the job is assigned to.
Код Cancel_Command::cancel_single() Cancel Command::cancel single WC 11.2.2
protected function cancel_single( $hook, $callback_args, $group ) {
if ( empty( $hook ) ) {
\WP_CLI::error( __( 'Please specify hook of action to cancel.', 'woocommerce' ) );
}
try {
$result = as_unschedule_action( $hook, $callback_args, $group );
} catch ( \Exception $e ) {
$this->print_error( $e, false );
}
if ( null === $result ) {
$e = new \Exception( __( 'Unable to cancel scheduled action: check the logs.', 'woocommerce' ) );
$this->print_error( $e, false );
}
$this->print_success( false );
}