ActionScheduler_wpPostStore::save_action()publicWC 1.0

Save action.

Method of the class: ActionScheduler_wpPostStore{}

Hooks from the method

Return

Int.

Usage

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->save_action( $action, $scheduled_date );
$action(ActionScheduler_Action) (required)
Scheduled Action.
$scheduled_date(DateTime)
Scheduled Date.
Default: null

ActionScheduler_wpPostStore::save_action() code WC 9.4.2

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 );
	}
}