Forum
Notifications
Clear all
Topic starter
You can log in a user to your WordPress programmatically without validation (username or password) by using these PHP codes:
$username = 'an username';
if (!is_user_logged_in()) {
$user = get_userdatabylogin($username);
$user_id = $user->ID;
wp_set_current_user($user_id, $user_login);
wp_set_auth_cookie($user_id);
do_action('wp_login', $user_login);
}
Posted : 16/04/2011 2:00 pm