prevent regenerate image filter loop
This commit is contained in:
parent
3732736029
commit
ae96a828ec
|
@ -241,7 +241,16 @@ class WC_Regenerate_Images_Request extends WC_Background_Process {
|
|||
* @return array
|
||||
*/
|
||||
public function adjust_intermediate_image_sizes( $sizes ) {
|
||||
return apply_filters( 'woocommerce_regenerate_images_intermediate_image_sizes', array( 'woocommerce_thumbnail', 'woocommerce_gallery_thumbnail', 'woocommerce_single' ) );
|
||||
// Prevent a filter loop.
|
||||
$unfiltered_sizes = array( 'woocommerce_thumbnail', 'woocommerce_gallery_thumbnail', 'woocommerce_single' );
|
||||
static $in_filter = false;
|
||||
if ( $in_filter ) {
|
||||
return $unfiltered_sizes;
|
||||
}
|
||||
$in_filter = true;
|
||||
$filtered_sizes = apply_filters( 'woocommerce_regenerate_images_intermediate_image_sizes', $unfiltered_sizes );
|
||||
$in_filter = false;
|
||||
return $filtered_sizes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue