Automattic\WooCommerce\Internal\Admin\Reports
ProductSearchQuery::parse_terms
Normalizes the search REST argument into a list of terms.
Метод класса: ProductSearchQuery{}
Хуков нет.
Возвращает
string[]. Search terms.
Использование
$result = ProductSearchQuery::parse_terms( $value );
- $value(строка|string[]) (обязательный)
- Raw argument value, a list of terms or a comma separated string.
Список изменений
| С версии 11.2.0 | Введена. |
Код ProductSearchQuery::parse_terms() ProductSearchQuery::parse terms WC 11.2.2
public static function parse_terms( $value ) {
// Not `wp_parse_list()`, which also splits on whitespace and would break multi-word terms.
$terms = is_array( $value ) ? $value : explode( ',', (string) $value );
return array_values(
array_filter(
array_map( 'sanitize_text_field', $terms ),
function ( $term ) {
return '' !== $term;
}
)
);
}