I have Wordpress with WooCommerce installed and I am trying to use this code to login an admin user:
if ( !is_user_logged_in() ) {
$user = get_userdatabylogin( $username ); // get_user_by('login', $user_login);
$id = $user->ID;
wp_set_current_user( $id, $user->user_login );
wp_set_auth_cookie( $id );
do_action( 'wp_login', $user->user_login );
}
But it is returning this error message:
Warning: Missing argument 2 for wc_maybe_store_user_agent() in plugins/woocommerce/includes/wc-core-functions.php on line 1516
I have tried looking around online but no one seems to have had this issue.