使用wp_set_auth_cookie在WordPress中验证用户

If User X is currently logged in and wp_set_auth_cookie is used to authenticate User Z, is User X automatically logged out?

Please note I am referring to the users using the same browser window.

https://codex.wordpress.org/Function_Reference/wp_set_auth_cookie

No. Even if the two users use the same username, they both can log in and use the site at the same time. You can test this by logging into a single WP site with on two separate browsers with the same user name. You'll see that you can navigate around the admin in both browsers fine. This fact holds true with different usernames as well.