Automattic\WooCommerce\Internal\Admin\Reports

ProductSearchQuery::skip_wp_query_results │ public static │ WC 11.2.0

Skips running a product search query, which is built for its statement rather than its rows.

Only the search query itself is skipped. A query another plugin runs from one of the filters above, to work out how to filter this one, still has to return its own results.

Метод класса: ProductSearchQuery{}

Хуков нет.

Возвращает

array|null. Posts to return instead of running the query, or null to run it.

Использование

$result = ProductSearchQuery::skip_wp_query_results( $posts, $wp_query );
$posts(массив|null) (обязательный)
Posts to return instead of running the query, or null to run it.
$wp_query(WP_Query) (обязательный)
Query being built.

Список изменений

С версии 11.2.0 Введена.

Код ProductSearchQuery::skip_wp_query_results() WC 11.2.2

public static function skip_wp_query_results( $posts, $wp_query ) {
	return $wp_query->get( self::TERMS_QUERY_VAR ) ? array() : $posts;
}