Reputation: 1
I have snippet below to login on wp-login page without password. I only need to know user login and I don’t need to input anything in password field. This sippet worked fine up to 6.2.2 WP version, but on 6.3 it doesn’t work. It wants password. How to modify this to make it compatible with 6.3 ? I can’t figure it out.
function admin_login($user, $username, $password)
{
$user = get_user_by("login", $username);
if ($user != "FALSE") {
wp_set_auth_cookie($user->ID);
} else {
return null;
}
return $user;
}
function hide_password_field()
{
?>
<style type="text/css">
body.login div#login form#loginform p:nth-child(2) {
display: none;
}
</style>
<?php
}
add_filter("authenticate", "admin_login", 10, 3);
add_action("login_head", "hide_password_field");
Upvotes: 0
Views: 445