Created
September 24, 2018 16:35
-
-
Save WordBits/6c575be6441f7d6057b26e5a94ec24c6 to your computer and use it in GitHub Desktop.
Auto login after register user in wordpress and redirect to a home page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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