Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Problem in auto login after registration

you should do so:

...} else {
                
                
                $site_url = get_site_url()."/myloginpage/";
                
                $has_success = true;
                $message[] = "Successful registration";
                
                global $wpdb;
                $key = $wpdb->get_row($wpdb->prepare("SELECT ID,user_activation_key FROM $wpdb->users WHERE user_login = %s",$usermobile));
                add_user_meta($key->ID,'usermobilenum',$usermobile);

                wp_set_current_user( $newUserID, $usermobile );
                wp_set_auth_cookie( $newUserID );
                //do_action( 'wp_login', $usermobile );
                    
                
                $redirecturl = site_url('/?signup=true&login=too');
                wp_redirect( $redirecturl );
                exit;

            }

        }
    }
}

Related Posts:

  1. I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
  2. Action wp_login_failed not working if only one field is filled out
  3. How to customise wp-login.php only for users who are setting a password for the first time?
  4. Redirect user after login/registration globally
  5. Restricting frontend acess based on user role otherwise redirect to login form
  6. How do I force “users must be registered and logged in” on subsites?
  7. Disabling standard registration login with username/email and password?
  8. Redirect wp-login
  9. Login user after registration programmatically
  10. Login form- no feedback
  11. How can I redirect user after entering wrong password?
  12. Separate registration and login for different roles
  13. SSO / authentication integration with external ‘directory service’
  14. How to prefill WordPress registration with social details
  15. Custom login form
  16. Prevent wp_login_form() from redirecting to wp-admin when there are errors
  17. How do I change the language of only the login page?
  18. Disable WordPress 3.6 idle logout / login modal window / session expiration
  19. Woocommerce registration page [closed]
  20. Avoid to load default WP styles in login screen
  21. WordPress registration message
  22. How to fake a WordPress login?
  23. How build a custom login/register form with error handling?
  24. Can not login with correct username and password
  25. How to remove the WordPress logo from login and register page?
  26. How can I add a custom script to footer of login page?
  27. Login email after registration never sent or received
  28. How to keep always logged in development environment
  29. custom login page redirect to logged in user profile page
  30. How do I check if a post is private?
  31. Receiving “This content cannot be displayed in a frame” error on login page
  32. How can I do customizations on login, registration and password recovery forms?
  33. What hooks should I use for pre-login and pre-registration actions?
  34. WordPress Login Footer URL
  35. Remove built in wordpress login and use only google auth
  36. Change Login Page for a Multisite Subsite
  37. Positioning the “Lost your password?” and “← Back to Site”
  38. send users logging in from wp-login.php directly to home page of site, rather than dashboard
  39. How to get login data (session) outside WordPress?
  40. Change register form action url
  41. Problem with logging in WP users automatically
  42. Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?
  43. Register/Login using only phone number?
  44. How to auto login after registration? [duplicate]
  45. Add class to input form in login form
  46. Allow access to a page for admins only
  47. Customizing login error messages
  48. Customizing the WordPress login form
  49. Force users to register in order to view website [duplicate]
  50. how to restrict user login whenever if a user puts on hold by editing wp-login action?
  51. wp_get_referer not working properly after wp_redirect
  52. deny IPs from wp-login using .htaccess
  53. auto login after registeration for wp-members plugin
  54. Login redirects and query strings
  55. Passing username to login screen
  56. Login error redirecting to wp-login page
  57. How To Change Wp Register/Login URL Permanently To My Custom Page
  58. How can I prevent my custom form from redirecting to wp-login?
  59. reset password link redirect to login page
  60. How do I replace “Username” in the WordPress login form?
  61. Custom Login iframe doesn’t work
  62. Password reset – Disabled for LDAP accounts
  63. How to Get Logged-in to “Remote WP Site” from my local script (in Same Browser)?
  64. Replace dash with space in username on login
  65. Autologin only working the second time
  66. replace wp-login.php login forms via a hook & use custom forms with wp-login form validation
  67. How to modify the action attribute of the wp-login.php?action=register form?
  68. Correct passwords keep appearing as incorrect
  69. How can I login as admin after redirect to custom login page
  70. Auto login between word press subdomain and a .net website
  71. Login form doesn’t log in
  72. Get the url of custom login page in the registration page
  73. How to change wordpress Log In text
  74. WordPress error on log out ‘Not Permitted’ and can’t log out
  75. By registering always make uppercase the first letter of the login
  76. Show reCaptcha on Custom Frontend Login & Register Form [closed]
  77. Best option to implement external register/login to WP from self-made API
  78. Auto Login After Registration
  79. Disable all other page except index,register,login till user login
  80. Is wp_login_form secure on a non secure page?
  81. Is the login encrypted before it is sent? If so how to do I encrypt it the same way?
  82. What speaks against using a custom login.php / register.php to wordpress?
  83. Form Action submit over https
  84. Do more action after login successfully
  85. Is there anyway to get the inputted password string from the login form?
  86. Login and Forgot password in Lightbox
  87. Forcing frontend login with UI switch
  88. How do I add Login fields and registration link to the header?
  89. How to make a user be able to register if such a login already exists?
  90. Prevent display password on wp-login.php
  91. Change default login auth
  92. wordpress login without password just email address (NO 2 factor authentication with email)
  93. Sending new registration meta values to admin by email
  94. WordPress SSL not working [closed]
  95. Where is the php file, that does the checks for login information?
  96. Hide Author page from others
  97. Are login functions considered part of the WP backend?
  98. Redirect User to login page
  99. WordPress registration page template
  100. Removing “public” user registration without completely turning it off?
Categories login Tags login, user-registration, wp-login-form, wp-redirect
bp_core_new_subnav_item shows new group tab but returns 404 when the tab runs. Works on another page
Changing CPT permalink

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress