Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableSearchQuery::sanitize_search_filters()privateWC 1.0

Sanitize search filter param.

Method of the class: OrdersTableSearchQuery{}

No Hooks.

Return

Array. Array of search filters.

Usage

// private - for code of main (parent) class only
$result = $this->sanitize_search_filters( $search_filter ): array;
$search_filter(string) (required)
Search filter param.

OrdersTableSearchQuery::sanitize_search_filters() code WC 9.3.3

private function sanitize_search_filters( string $search_filter ): array {
	$core_filters = array(
		'order_id',
		'transaction_id',
		'customer_email',
		'customers', // customers also searches in meta.
		'products',
	);

	if ( 'all' === $search_filter || '' === $search_filter ) {
		return $core_filters;
	} else {
		return array( $search_filter );
	}
}