Auto Login on Registration

Automatically log in users after they register.

<?php
function auto_login_after_registration($user_id) {
    wp_set_auth_cookie($user_id);
    wp_redirect(home_url());
    exit;
}
add_action('user_register', 'auto_login_after_registration');

Post Comment