ActionScheduler_wpPostStore::get_post_status_by_action_status()protectedWC 1.0

Get post status by action status.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_post_status_by_action_status( $action_status );
$action_status(строка) (обязательный)
Action status.

Код ActionScheduler_wpPostStore::get_post_status_by_action_status() WC 8.7.0

protected function get_post_status_by_action_status( $action_status ) {

	switch ( $action_status ) {
		case self::STATUS_COMPLETE:
			$post_status = 'publish';
			break;
		case self::STATUS_CANCELED:
			$post_status = 'trash';
			break;
		default:
			if ( ! array_key_exists( $action_status, $this->get_status_labels() ) ) {
				throw new InvalidArgumentException( sprintf( 'Invalid action status: "%s".', $action_status ) );
			}
			$post_status = $action_status;
			break;
	}

	return $post_status;
}