diff --git a/plugins/woocommerce/changelog/update-31881-lazyload-ua-option b/plugins/woocommerce/changelog/update-31881-lazyload-ua-option new file mode 100644 index 00000000000..c07bff6dae7 --- /dev/null +++ b/plugins/woocommerce/changelog/update-31881-lazyload-ua-option @@ -0,0 +1,4 @@ +Significance: minor +Type: tweak + +Make the option 'woocommerce_tracker_ua' load on demand. diff --git a/plugins/woocommerce/includes/wc-user-functions.php b/plugins/woocommerce/includes/wc-user-functions.php index a874c92a052..6e688301a9d 100644 --- a/plugins/woocommerce/includes/wc-user-functions.php +++ b/plugins/woocommerce/includes/wc-user-functions.php @@ -862,7 +862,7 @@ function wc_maybe_store_user_agent( $user_login, $user ) { if ( 'yes' === get_option( 'woocommerce_allow_tracking', 'no' ) && user_can( $user, 'manage_woocommerce' ) ) { $admin_user_agents = array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) ); $admin_user_agents[] = wc_get_user_agent(); - update_option( 'woocommerce_tracker_ua', array_unique( $admin_user_agents ) ); + update_option( 'woocommerce_tracker_ua', array_unique( $admin_user_agents ), false ); } } add_action( 'wp_login', 'wc_maybe_store_user_agent', 10, 2 );