Make the option 'woocommerce_tracker_ua' load on demand. (#33274)
This commit is contained in:
parent
16a478eeb2
commit
4c164c3247
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: tweak
|
||||||
|
|
||||||
|
Make the option 'woocommerce_tracker_ua' load on demand.
|
|
@ -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' ) ) {
|
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 = array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) );
|
||||||
$admin_user_agents[] = wc_get_user_agent();
|
$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 );
|
add_action( 'wp_login', 'wc_maybe_store_user_agent', 10, 2 );
|
||||||
|
|
Loading…
Reference in New Issue