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

How can I redirect on a url after successful registration?

You used in_array wrong. There might be some redundancy in your function too(depending on what you’re doing). You could use something like this to redirect your users:

add_filter('login_redirect', 'redirect_previous_page', 10);

function redirect_previous_page(){
    global $user;
    if ( in_array( 'administrator', $user->roles ) ) {
        return admin_url();
    } else {
        return 'http://localhost/'; //add your link here
    } 
}

Related Posts:

  1. Disable Or Redirect WP-login.php
  2. How build a custom login/register form with error handling?
  3. Multi-steps WordPress registration : in 4 steps how to?
  4. I want to disable E-Mail verifcation / activation when a user signs up for my WordPress site
  5. login_enqueue_scripts does not ovewrite the default styles
  6. Modify wp-login.php labels: Username to Email
  7. How to change “Registration complete. Please check your e-mail.” in wp-login.php
  8. How to customise wp-login.php only for users who are setting a password for the first time?
  9. How can I do customizations on login, registration and password recovery forms?
  10. How to use wp-login.php page only for logout?
  11. Redirect user after login/registration globally
  12. change register url on wp-login page
  13. Can’t access wp-admin
  14. How to auto login after registration? [duplicate]
  15. How do you add a custom link to the wordpress login page?
  16. wp-login.php register/lost password links to buttons?
  17. How to trigger a login form notice message?
  18. Set user password after creating user
  19. A child theme version of wp-login
  20. reset password label text change
  21. Add text on wordpress admin login page
  22. How do I force “users must be registered and logged in” on subsites?
  23. How to bypass the username as a required field in registration and just use email address instead?
  24. Is it possible to remove the version number from the wp-login.php page?
  25. Anyway to output the registration form like the login form with wp_login_form()?
  26. wp_login_form() redirect not redirecting users < admin
  27. WordPress Register Form
  28. Login redirect on wp theme
  29. Can’t log in. Log in button missing [closed]
  30. Require WP login for outside access
  31. Auto login from custom registration form
  32. Modify WP-Login Page With Javascript?
  33. Disabling standard registration login with username/email and password?
  34. if username or password is incorrect wp-login returns a blank page
  35. Where is the email content for retrieve_password_message stored?
  36. What is the CODEX intercept for wp-login.php?action=lostpassword
  37. Call header and footer on login page
  38. Prevent redirect on custom wordpress login form
  39. Replace standard Login and Register form for Woocommerce [closed]
  40. How to destroy sessions after a user logout [closed]
  41. How to add required attribute to wp_login_form fields?
  42. WordPress “remember me” – How should it work?
  43. Changing the title of “
  44. Log In & Log Out Code In Header
  45. How to fix Sign In option in WordPress
  46. I lock the site’s contents, click on a post, redirect to login, enter uname+password but fail to redirect to article
  47. How to access the actual input html of the login form
  48. Creating a custom login on site.
  49. Login page wordpress tagline remove [duplicate]
  50. Adding line break in esc_html__
  51. Copying My account/Login/Register button outside header
  52. Issue with cookies in wp-login
  53. Problem in auto login after registration
  54. Unable to login after registration
  55. Add content in wp login page
  56. Is it possible to check if password is correct in wp_authenticate_user?
  57. Modify login page after clicking “login” button, and before it arrives at redirect
  58. How to enable “remember me” checkbox in login forms by default?
  59. Frontend registration form doesn’t save data only redirects to wp-login
  60. custom login query for custom login form?
  61. WordPress reCAPTCHA Problem
  62. Customizing WordPress Login URL
  63. It is possible that to get data in wp_login.php to your own php file in wordpress?
  64. Using gettext on wp-login.php won’t change “Back to site name” text
  65. Add video to wordpress login page
  66. WordPress login form with fancybox
  67. I wanna create a custom login form template
  68. Add custom field in wp_login_form()
  69. Login user after registration programmatically
  70. Retrieve password only by login. Users with same email
  71. wp-login.php not returning error messages / or gives 404
  72. Registration page background color covering 1 screen not covering full page
  73. Website visible only to Registered users (non wp-admin)
  74. Registration fields prefilled with URL parameters
  75. Custom error messages for login and lost password forms
  76. Spam Registrations Bypassing WordPress Registration
  77. WordPress does not allow me to login until another dashboard is open
  78. Redirect after registration and auto login is not working
  79. What does this PHP function code mean? [closed]
  80. How to change the default registration email ? (plugin and/or non-plugin)
  81. Check if wp-login is current page
  82. How to display user registration form on front-end of the website?
  83. Add multiple custom fields to the general settings page
  84. How can I redirect user after entering wrong password?
  85. How to allow an user role to create a new user under a role which lower than his level only?
  86. Is it possible to remove username field from the registration page? If so, how?
  87. Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
  88. Separate registration and login for different roles
  89. SSO / authentication integration with external ‘directory service’
  90. Adding fields to the “Add New User” screen in the dashboard
  91. users table – user_name vs. nicename
  92. Disable user registration password email
  93. What is an easy way to display a front-end user registration form?
  94. How can I un-reserve a pending username registration?
  95. How to prefill WordPress registration with social details
  96. How do I programmatically set default role for new users?
  97. wordpress redirect after password reset
  98. Display user registration date
  99. Customizing the URLs of WordPress Login and Sign-up Pages?
  100. The website cannot display the page
Categories wp-login-form Tags user-registration, wp-login-form
Show content if page is a grandchild of top level page
Loop not showing first post

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