Automattic\WooCommerce\Blocks\BlockTypes
ProductQuery::get_filter_by_keyword_query
Returns the keyword filter from the given query.
Метод класса: ProductQuery{}
Хуков нет.
Возвращает
array. The keyword filter, or an empty array if none is found.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_filter_by_keyword_query( $query ): array;
- $query(WP_Query) (обязательный)
- The query to extract the keyword filter from.
Код ProductQuery::get_filter_by_keyword_query() ProductQuery::get filter by keyword query WC 11.1.0
private function get_filter_by_keyword_query( $query ): array {
if ( ! is_array( $query ) ) {
return [];
}
if ( isset( $query['s'] ) ) {
return [ 's' => $query['s'] ];
}
return [];
}