do not use image size cache while in customizer (#38875)
Co-authored-by: Ron Rennick <ronald.rennick@automattic.com>
This commit is contained in:
parent
b0ae9dac27
commit
4476129595
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
do not use image size cache while in customizer
|
|
@ -927,7 +927,7 @@ function wc_get_theme_support( $prop = '', $default = null ) {
|
|||
*/
|
||||
function wc_get_image_size( $image_size ) {
|
||||
$cache_key = 'size-' . ( is_array( $image_size ) ? implode( '-', $image_size ) : $image_size );
|
||||
$size = wp_cache_get( $cache_key, 'woocommerce' );
|
||||
$size = ! is_customize_preview() ? wp_cache_get( $cache_key, 'woocommerce' ) : false;
|
||||
|
||||
if ( $size ) {
|
||||
return $size;
|
||||
|
@ -983,8 +983,11 @@ function wc_get_image_size( $image_size ) {
|
|||
|
||||
$size = apply_filters( 'woocommerce_get_image_size_' . $image_size, $size );
|
||||
|
||||
wp_cache_set( $cache_key, $size, 'woocommerce' );
|
||||
|
||||
if ( is_customize_preview() ) {
|
||||
wp_cache_delete( $cache_key, 'woocommerce' );
|
||||
} else {
|
||||
wp_cache_set( $cache_key, $size, 'woocommerce' );
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue