Automattic\WooCommerce\Blocks\BlockTypes
ProductQuery::get_filter_by_keyword_query
Returns the keyword filter from the given query.
Method of the class: ProductQuery{}
No Hooks.
Returns
Array. The keyword filter, or an empty array if none is found.
Usage
// private - for code of main (parent) class only $result = $this->get_filter_by_keyword_query( $query ): array;
- $query(WP_Query) (required)
- The query to extract the keyword filter from.
ProductQuery::get_filter_by_keyword_query() ProductQuery::get filter by keyword query code WC 10.6.2
private function get_filter_by_keyword_query( $query ): array {
if ( ! is_array( $query ) ) {
return [];
}
if ( isset( $query['s'] ) ) {
return [ 's' => $query['s'] ];
}
return [];
}