Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableQuery::sanitize_status()privateWC 1.0

Sanitizes the 'status' query var.

{} Это метод класса: OrdersTableQuery{}

Хуков нет.

Возвращает

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->sanitize_status(): void;

Код OrdersTableQuery::sanitize_status() WC 6.9.4

private function sanitize_status(): void {
	// Sanitize status.
	$valid_statuses = array_keys( wc_get_order_statuses() );

	if ( empty( $this->args['status'] ) || 'any' === $this->args['status'] ) {
		$this->args['status'] = $valid_statuses;
	} elseif ( 'all' === $this->args['status'] ) {
		$this->args['status'] = array();
	} else {
		$this->args['status'] = is_array( $this->args['status'] ) ? $this->args['status'] : array( $this->args['status'] );

		foreach ( $this->args['status'] as &$status ) {
			$status = in_array( 'wc-' . $status, $valid_statuses, true ) ? 'wc-' . $status : $status;
		}

		$this->args['status'] = array_unique( array_filter( $this->args['status'] ) );
	}
}