WC_Query::prime_thumbnail_caches
Prime featured image caches for product queries to avoid individual queries during rendering.
Method of the class: WC_Query{}
No Hooks.
Returns
Array.
Usage
$WC_Query = new WC_Query(); $WC_Query->prime_thumbnail_caches( $posts, $query );
- $posts(array) (required)
- Posts from WP Query.
- $query(WP_Query) (required)
- Current query.
Changelog
| Since 10.8.0 | Introduced. |
WC_Query::prime_thumbnail_caches() WC Query::prime thumbnail caches code WC 10.8.1
public function prime_thumbnail_caches( $posts, $query ) {
if ( 'product_query' === $query->get( 'wc_query' ) ) {
update_post_thumbnail_cache( $query );
}
return $posts;
}