Automattic\WooCommerce\Internal\ProductGallery
ProductMediaGallery::prime_attachment_caches
Prime attachment post caches for media gallery items.
Method of the class: ProductMediaGallery{}
No Hooks.
Returns
void. Nothing (null).
Usage
$result = ProductMediaGallery::prime_attachment_caches( $media_gallery, $include_posters ): void;
- $media_gallery(array) (required)
- Media gallery items.
- $include_posters(true|false)
- Whether to include resolved video poster IDs.
Default:false
ProductMediaGallery::prime_attachment_caches() ProductMediaGallery::prime attachment caches code WC 11.3.0
public static function prime_attachment_caches( array $media_gallery, bool $include_posters = false ): void {
$attachment_ids = self::get_attachment_ids( $media_gallery, $include_posters );
if ( ! empty( $attachment_ids ) ) {
_prime_post_caches( $attachment_ids );
}
}