Redirect to the previous page after e-mail activation

Use this code to dynamically override the URL redirect after e-mail activation setting and redirect users to the page where they were registered after e-mail activation. This may be helpful if the registration form is placed in a popup or sidebar and users may be registered from any page.

Screen wp-admin > Ultimate Member > User Roles > Edit Role.

How to customize redirect after activation

You should save the address of the page where the user was registered then use the hook um_after_email_confirmation_redirect to override the "URL redirect after e-mail activation" setting with the saved address.

Try to use the Referer header to get the page URL. This header may be empty or incorrect. In this case you have to use your own solution to save the page URL.

Add a random parameter to the redirect URL if you want to bypass caching. This may be needed if the page that contains restricted or role-specific content is cached.

Code example

NOTE: We have created this code example to provide guidance and to make it easier for you to implement this code into your website. However, we are not able to provide any support when it comes to customizing the plugin. If you need help implementing this code, please hire a developer.