Login Redirect Placeholders & Use Cases

When creating a redirection rule, there are placeholders or merge tags available for your use. You can see a list of them by clicking the “View Available Placeholders” links.

Some of the available placeholders include:

  • {{username}}: Username of user
  • {{user_slug}}: Author URL slug or user nicename
  • {{website_url}}: Website URL
  • {{current_page}}: URL of the page a user is logging in from
  • {{previous_page}}: URL of the page a user was on before redirection to the login page

Some Placeholder Use Cases

Redirecting Users to Their Profiles

Say you run a membership site with a user profile feature and the profile URL structure is https://yourwebsite.com/profile/username where the username is obviously the username of a user. And you want to redirect your users to their profile after they log in. The Login URL would be:

https://yourwebsite.com/profile/{{username}}

Redirecting Users to The Referrer Page

If you want to redirect users back to the page they were on before they were redirected to the login page, use the {{previous_page}} placeholder as the Login URL.

Redirecting Users to The Current Page

Say your website has a modal or popup login form and you want users to be redirected to the same page after they are logged in, use the {{current_page}} placeholder as the Login URL.