Commit 5dae45f040 for woocommerce
commit 5dae45f04066e6720e1481f78cb17193f43e06b2
Author: Michal Iwanow <4765119+mcliwanow@users.noreply.github.com>
Date: Mon Jan 19 10:45:19 2026 +0100
Stop autoloading `woocommerce_status_log_db_sources` option (#62806)
* Stop autoloading woocommerce_status_log_db_sources option
This option is not needed for 99% of pages. It's used only on admin page with logs, so we don't need to autoload it.
It can also grow (especially with custom loggers which don't implement clear() method). We noticed that on one site it would autoload almost 4MB option.
* Add changefile(s) from automation for the following project(s): woocommerce
---------
Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>
diff --git a/plugins/woocommerce/changelog/62806-fix-do-not-autoload-woocommerce_status_log_db_sources-option b/plugins/woocommerce/changelog/62806-fix-do-not-autoload-woocommerce_status_log_db_sources-option
new file mode 100644
index 0000000000..60a6e5cb17
--- /dev/null
+++ b/plugins/woocommerce/changelog/62806-fix-do-not-autoload-woocommerce_status_log_db_sources-option
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Stop autoloading `woocommerce_status_log_db_sources` option
\ No newline at end of file
diff --git a/plugins/woocommerce/includes/admin/class-wc-admin-log-table-list.php b/plugins/woocommerce/includes/admin/class-wc-admin-log-table-list.php
index 14a2d99e81..7a98b4c831 100644
--- a/plugins/woocommerce/includes/admin/class-wc-admin-log-table-list.php
+++ b/plugins/woocommerce/includes/admin/class-wc-admin-log-table-list.php
@@ -331,8 +331,7 @@ class WC_Admin_Log_Table_List extends WP_List_Table {
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Not necessary.
$sources = $wpdb->get_col( $sql );
- // Autoload this option so that the log handler doesn't have to run another query when checking the source list.
- update_option( self::SOURCE_CACHE_OPTION_KEY, $sources, true );
+ update_option( self::SOURCE_CACHE_OPTION_KEY, $sources );
return $sources;
}