Codex tools: Log in
Authenticates a user with option to remember credentials. Replaces deprecated function wp_login.
<?php wp_signon( $credentials, $secure_cookie ) ?>
NOTE: If you don't provide $credentials, wp_signon uses the $_POST variable (the keys being "log", "pwd" and "rememberme").
$creds = array(); $creds['user_login'] = 'example'; $creds['user_password'] = 'plaintextpw'; $creds['remember'] = true; $user = wp_signon( $creds, false ); if ( is_wp_error($user) ) echo $user->get_error_message();
wp_signon() is located in