Automattic\WooCommerce\Blocks\BlockTypes
ProductQuery::filter_query_to_only_include_ids
Apply the query only to a subset of products
Метод класса: ProductQuery{}
Хуков нет.
Возвращает
Массив.
Использование
// private - только в коде основоного (родительского) класса $result = $this->filter_query_to_only_include_ids( $query, $ids );
- $query(массив) (обязательный)
- The query.
- $ids(массив) (обязательный)
- Array of selected product ids.
Код ProductQuery::filter_query_to_only_include_ids() ProductQuery::filter query to only include ids WC 10.7.0
private function filter_query_to_only_include_ids( $query, $ids ) {
if ( ! empty( $ids ) ) {
$query['post__in'] = empty( $query['post__in'] ) ?
$ids : array_intersect( $ids, $query['post__in'] );
}
return $query;
}