diff --git a/classes/Bulk/Bulk.php b/classes/Bulk/Bulk.php index 98e6cc08..19838714 100644 --- a/classes/Bulk/Bulk.php +++ b/classes/Bulk/Bulk.php @@ -594,18 +594,20 @@ public function bulk_get_stats_callback() { * @param array $old_value The old option value. * @param array $value The new option value. * + * Please note that the convert_to_avif new value is a checkbox, + * so it equals 1 when it's set otherwise it's not set. + * That's why we need to use empty function when checking its value. + * * @return void */ public function maybe_generate_missing_nextgen( $old_value, $value ) { - if ( isset( $old_value['convert_to_avif'] ) && isset( $value['convert_to_avif'] ) ) { - return; - } - - if ( ! isset( $old_value['convert_to_avif'] ) && ! isset( $value['convert_to_avif'] ) ) { + if ( empty( $old_value['convert_to_avif'] ) === empty( $value['convert_to_avif'] ) ) { + // Old value = new value so do nothing. return; } - if ( isset( $value['convert_to_avif'] ) && ! (bool) $value['convert_to_avif'] ) { + if ( empty( $value['convert_to_avif'] ) ) { + // new value is disabled, do nothing. return; }