Redirect to previous page after login when using Ultimate Member plugin for Wordpress

Updated: June 3, 2020
  • When i go to my website and click on the download button. Website will redirect to login page.
  • Unfortunately, after i enter user name and password, ultimate member redirects me to the profile page so i have to go to the download link again.
  • I have spent a lot of time for researching this issue. I thought that Uttimate member is a very popular membership addon and they could support that. However, Ultimate member only supports to redirect to a specific URL. You can find this option in Ultimate member -> User roles -> your user role e.g. Member and “Registration options” section – Action to be taken after registration and select redirect to URL.
  • it is quite frustrated. As per the UM documentation here, i tried to use hook um_dynamic_login_page_redirect() but it does not work.
  • Finally, i tried to modify the UM core. I found out that i need to tweak the file templates\login.php and add the following code:
  • Of course, you have to change core everytime you upgrade UM to the latest version. It is better if we could use the UM hook. But for now, it is the best solution.