diff --git a/includes/api/class-wc-rest-system-status-tools-controller.php b/includes/api/class-wc-rest-system-status-tools-controller.php index 44b6379b4d1..fcb54c7257a 100644 --- a/includes/api/class-wc-rest-system-status-tools-controller.php +++ b/includes/api/class-wc-rest-system-status-tools-controller.php @@ -183,7 +183,7 @@ class WC_REST_System_Status_Tools_Controller extends WC_REST_Controller { ); // Jetpack does the image resizing heavy lifting so you don't have to. - if ( ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) || ! apply_filters( 'woocommerce_background_image_regeneration', ! is_multisite() ) ) { + if ( ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) || ! apply_filters( 'woocommerce_background_image_regeneration', true ) ) { unset( $tools['regenerate_thumbnails'] ); } diff --git a/includes/class-wc-regenerate-images.php b/includes/class-wc-regenerate-images.php index d1eb388f571..407e42833f0 100644 --- a/includes/class-wc-regenerate-images.php +++ b/includes/class-wc-regenerate-images.php @@ -47,16 +47,19 @@ class WC_Regenerate_Images { return; } - // Regenerate thumbnails in the background after settings change. Not ran on multisite to avoid multiple simultanious jobs, and not required when Jetpack Photon is in use. - if ( apply_filters( 'woocommerce_background_image_regeneration', ! is_multisite() ) ) { + if ( apply_filters( 'woocommerce_background_image_regeneration', true ) ) { include_once WC_ABSPATH . 'includes/class-wc-regenerate-images-request.php'; self::$background_process = new WC_Regenerate_Images_Request(); add_action( 'admin_init', array( __CLASS__, 'regenerating_notice' ) ); add_action( 'woocommerce_hide_regenerating_thumbnails_notice', array( __CLASS__, 'dismiss_regenerating_notice' ) ); - add_action( 'customize_save_after', array( __CLASS__, 'maybe_regenerate_images' ) ); - add_action( 'after_switch_theme', array( __CLASS__, 'maybe_regenerate_images' ) ); + + // Regenerate thumbnails in the background after settings changes. Not ran on multisite to avoid multiple simultanious jobs. + if ( ! is_multisite() ) { + add_action( 'customize_save_after', array( __CLASS__, 'maybe_regenerate_images' ) ); + add_action( 'after_switch_theme', array( __CLASS__, 'maybe_regenerate_images' ) ); + } } } diff --git a/includes/customizer/class-wc-shop-customizer.php b/includes/customizer/class-wc-shop-customizer.php index 31c5351ced2..222067bad10 100644 --- a/includes/customizer/class-wc-shop-customizer.php +++ b/includes/customizer/class-wc-shop-customizer.php @@ -443,12 +443,23 @@ class WC_Shop_Customizer { * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ private function add_product_images_section( $wp_customize ) { + if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) { + $regen_description = ''; // Nothing to report; Jetpack will handle magically. + } elseif ( apply_filters( 'woocommerce_background_image_regeneration', true ) && ! is_multisite() ) { + $regen_description = __( 'After publishing your changes, new image sizes will be generated automatically.', 'woocommerce' ); + } elseif ( apply_filters( 'woocommerce_background_image_regeneration', true ) && is_multisite() ) { + $regen_description = sprintf( __( 'After publishing your changes, new image sizes may not be shown until you regenerate thumbnails. You can do this from the tools section in WooCommerce or by using a plugin such as Regenerate Thumbnails.', 'woocommerce' ), admin_url( 'admin.php?page=wc-status&tab=tools' ), 'https://en-gb.wordpress.org/plugins/regenerate-thumbnails/' ); + } else { + $regen_description = sprintf( __( 'After publishing your changes, new image sizes may not be shown until you Regenerate Thumbnails.', 'woocommerce' ), 'https://en-gb.wordpress.org/plugins/regenerate-thumbnails/' ); + } + $wp_customize->add_section( 'woocommerce_product_images', array( - 'title' => __( 'Product Images', 'woocommerce' ), - 'priority' => 20, - 'panel' => 'woocommerce', + 'title' => __( 'Product Images', 'woocommerce' ), + 'description' => $regen_description, + 'priority' => 20, + 'panel' => 'woocommerce', ) );