Automattic\WooCommerce\Internal\Admin\Reports
ProductSearchQuery::skip_wp_query_results
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.
Method of the class: ProductSearchQuery{}
No Hooks.
Returns
array|null. Posts to return instead of running the query, or null to run it.
Usage
$result = ProductSearchQuery::skip_wp_query_results( $posts, $wp_query );
- $posts(array|null) (required)
- Posts to return instead of running the query, or null to run it.
- $wp_query(WP_Query) (required)
- Query being built.
Changelog
| Since 11.2.0 | Introduced. |
ProductSearchQuery::skip_wp_query_results() ProductSearchQuery::skip wp query results code WC 11.3.0
public static function skip_wp_query_results( $posts, $wp_query ) {
return $wp_query->get( self::TERMS_QUERY_VAR ) ? array() : $posts;
}