Instantly share code, notes, and snippets.

Embed
What would you like to do?
Auto login after register user in wordpress and redirect to a home page.
<?php
// Download this snippet as a plugin and more at: https://wordbits.io/snippet/auto-login-after-registration/
// Created by: Ravi Patel
?>
<?php
function auto_login_new_user( $user_id ) {
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
wp_redirect( home_url() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment