DD DevDome Track. Protect. Grow.
Redirects & Links

Redirect After Login in WordPress: By Role, by Page, Without Code

Subscribers do not need the dashboard, clients should land on their project page, and you should land where you were. Three rules cover it.

On this page
  1. What WordPress does by default
  2. The filter that decides
  3. Three rules that cover most sites
  4. Logout too
  5. Where a redirect plugin fits
  6. Avoiding the loop
  7. Keep the destination on your own site
  8. Test as every role

To redirect after login in WordPress you change one decision: where the user goes once wp-login.php accepts the password. WordPress defaults to the dashboard for everyone, which suits administrators and almost nobody else. A subscriber should see the site, a customer their account, a client their project page, and someone who was interrupted by a login prompt should go back to where they were. One filter controls all of it, and most redirect plugins wrap that filter in a settings table.

What WordPress does by default

After a successful login, WordPress looks for a redirect_to value. If a user clicked a link to a protected page and was bounced to the login form, redirect_to carries that page’s URL and the user goes back there. If they came to wp-login.php directly, there is no redirect_to and they land on the dashboard, admin or subscriber alike.

That second case is the one to fix. A subscriber in the dashboard sees a confusing screen with nothing to do and a profile form. A customer expects their orders. Neither should see wp-admin.

The filter that decides

The login_redirect filter runs on every successful login and receives three things: the URL WordPress intends to use, the requested redirect_to value, and the user who just logged in. Whatever URL you return is where they go.

That gives you everything you need for rules:

  • Check the user’s roles and return a role-specific page.
  • Check whether redirect_to was set and honour it.
  • Exempt administrators so they keep the dashboard.

A plugin that exposes a role-to-URL table is doing exactly this, with a settings screen instead of code. If you are comfortable with a few lines in a small plugin, the filter is all you need.

Three rules that cover most sites

Rule 1: return visitors to where they were. If redirect_to points to a page on your own site, use it. Do not override it with a role rule; a customer who clicked a protected download should get the download, not the account page. The exception is when redirect_to points at wp-admin and the user has no business there; then send them to the role default instead.

Rule 2: role defaults. Subscribers to the homepage or a members area. Customers to the account page. Editors and authors to the posts list, which is inside the dashboard but is the screen they actually use. Clients on an agency site to their project page. One row per role, lowest to highest.

Rule 3: administrators are exempt. Always. The classic mistake is a rule that sends “all users” somewhere and locks the admin out of the admin. Test as a non-admin user in a private window, never only as yourself.

Logout too

The logout_redirect filter mirrors login. By default WordPress sends people to the login screen with a “you are now logged out” message, which is an odd place to leave a customer. Send them to the homepage, or to the page they logged out from if it is public. Membership and shop plugins usually have their own setting for this; set it there and do not duplicate it.

Where a redirect plugin fits

Login redirects are a user-based decision, not a URL-based one, so the rule lives in the login filter rather than in a general redirect table. A URL redirect manager handles the other half of the job around login flows:

  • Old login and account URLs after a plugin change, redirected to the new ones.
  • A members URL that should go to the login page for logged-out visitors and the members page for logged-in ones.
  • Geo or device rules for landing pages that lead into a signup.

DevDome Redirect Manager covers that side: unlimited rules with no paid tier, 301, 302, 307 and 308 per rule, geo, device and schedule targeting, click counts per rule, and automatic purging of ten cache plugins so a stale cached page never serves a dead redirect. We make it, so weigh that; it is not a login-redirect plugin and does not try to be.

Avoiding the loop

Two rules fighting is how “too many redirects” happens on login pages. The usual pairs: a login redirect sending customers to My Account while WooCommerce sends them to the shop; a role rule sending editors to the homepage while a membership plugin sends them to the dashboard; a URL redirect from /login/ to wp-login.php combined with a plugin that rewrites wp-login.php back to /login/.

Keep one owner for each decision. The plugin that renders the login form owns the post-login destination. The URL redirect manager owns URL changes. If you see a loop, disable one rule at a time until it clears, then decide which one stays.

Keep the destination on your own site

One safety rule for any login redirect: never send a user to a URL that came from the request without checking it points at your own domain. The redirect_to parameter is user-controlled, and an attacker can craft a login link whose redirect_to points at a lookalike site, so that a user who logs in on your real site is then sent to a fake one that asks them to log in again. WordPress’s own handling validates the destination against allowed hosts; if you write a custom rule, keep that validation rather than returning the raw parameter, and if you use a plugin, confirm it only accepts internal destinations.

Test as every role

Create one test user per role you have rules for, log in as each in a private window, and confirm the landing page. Then test the interrupted-page case: visit a protected page logged out, log in, confirm you return to it. Five minutes, and your users never see the dashboard again unless they belong there.

Related reading: 410 vs 404: Which Status Code to Use for Deleted Pages.

Disclosure: DevDome publishes this blog and makes the products it mentions. We describe what they do rather than promise results.

Key takeaways

  • By default WordPress sends every user to the dashboard after login, which is wrong for almost everyone except administrators.
  • The login_redirect filter decides the destination and receives the user, so role-based rules are a few lines of code or a setting in a plugin.
  • Respect the redirect_to parameter: a user who was sent to login from a protected page should return there.
  • Never redirect administrators away from the dashboard by accident. Exempt them explicitly.
  • Logout deserves the same thought. Send people to the homepage or the page they left, not the login screen.

Sources

  1. WordPress Developer Resources: login_redirect filter : the filter, its arguments and the user object
  2. WordPress Developer Resources: logout_redirect filter : the matching filter for logout
  3. WordPress Developer Resources: wp_login_url() : how redirect_to is attached to the login link

Links last checked October 17, 2026.

Frequently asked questions

Why do my users land on the dashboard after login?

That is WordPress's default for anyone who logs in through wp-login.php without a redirect_to value. Change it with the login_redirect filter, a small plugin, or your membership plugin's own setting if you have one.

Can I redirect different roles to different pages?

Yes. The login_redirect filter receives the user object, so you can check roles and return a different URL for subscribers, customers, editors and so on. Most redirect plugins expose this as a role-to-URL table.

What is redirect_to in the login URL?

A parameter WordPress adds when it sends a user to log in from a protected page. After login, the user should go back to that page. Any custom redirect should honour it unless there is a reason not to.

Does this work with WooCommerce or membership plugins?

They use their own login forms and often their own redirect settings. WooCommerce sends customers to My Account by default and offers a filter for it. Set the rule in one place, the plugin that owns the form, to avoid two rules fighting.

DevDome Team WordPress plugin builders

The DevDome team builds lightweight, performance-first WordPress plugins and free tools for site owners, founders and marketers. We write about the exact problems our plugins solve, in plain language for people who run real sites.