Redirect back to previous page after login instead of account


I found the gist for redirecting to a specific URL but we would like to redirect all user to previous page after login.

If you could please provide a snippet for that. Thanks.


Sorry, there’s no simple code snippet for this, it would require a custom implementation. If customizations beyond the available features are required for your site, please consider hiring someone for custom work


Forgot to mention we are not using hivepress login form, instead we are using the default WordPress login. After login it redirects to /account/settings, we would like to redirect to the homepage instead.

Maybe this can have an easier solution?

Yes, if you replaced the login form the redirect flow may be broken, this would require further fixes/customizations. When you use the default HivePress login form, it just refreshes the page or saves the “redirect” parameter value from the current URL to redirect user back to it after login/registration.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.