Codex tools: Log in
Contents |
The authenticate filter hook is used to perform additional validation/authentication any time a user logs in to WordPress.
Note: wp_authenticate_user can also be used if you want to perform any additional validation after WordPress's basic validation, but before a user is logged in.
This hook should return either a WP_User() object or, if generating an error, a WP_Error() object.
The basic usage is as follows...
add_filter('authenticate', 'myplugin_auth_signon', 30, 3);
function myplugin_auth_signon ($username, $password) {
return $user;
}
This hook passes two parameters, $user and $password (encrypted). In order to generate an error on login, you will need to return a new WP_Error() object.
The authenticate hook is located in /wp-includes/pluggable.php within wp_authenticate()
Return to Plugin API/Filter Reference