ActionScheduler_wpPostStore::save_action()publicWC 1.0

Save action.

Метод класса: ActionScheduler_wpPostStore{}

Хуки из метода

Возвращает

int.

Использование

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->save_action( $action, $scheduled_date );
$action(ActionScheduler_Action) (обязательный)
Scheduled Action.
$scheduled_date(DateTime)
Scheduled Date.
По умолчанию: null

Код ActionScheduler_wpPostStore::save_action() WC 8.7.0

public function save_action( ActionScheduler_Action $action, DateTime $scheduled_date = null ) {
	try {
		$this->validate_action( $action );
		$post_array = $this->create_post_array( $action, $scheduled_date );
		$post_id    = $this->save_post_array( $post_array );
		$this->save_post_schedule( $post_id, $action->get_schedule() );
		$this->save_action_group( $post_id, $action->get_group() );
		do_action( 'action_scheduler_stored_action', $post_id );
		return $post_id;
	} catch ( Exception $e ) {
		/* translators: %s: action error message */
		throw new RuntimeException( sprintf( __( 'Error saving action: %s', 'woocommerce' ), $e->getMessage() ), 0 );
	}
}