wc_maybe_store_user_agent()
Store user agents. Used for tracker.
No Hooks.
Return
null
. Nothing (null).
Usage
wc_maybe_store_user_agent( $user_login, $user );
- $user_login(string) (required)
- User login.
- $user(int|object) (required)
- User.
Changelog
Since 3.0.0 | Introduced. |
wc_maybe_store_user_agent() wc maybe store user agent code WC 9.4.2
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 ), false ); } }