You might be surprised at how much difference one tiny change can make – and the annoyance such a small feature can present when you don’t know how to change it.

You’ve probably noticed that users are always redirected to a certain page after they log in, and it might not necessarily make sense for your website. Where people land after they log in can have a bigger impact on user experience than you might expect, saving them time or preventing confusion.

But as for editing this small, obscure feature, where to start? If you want to change the login redirect page in WordPress, this tutorial will guide you through it both with plugins and manually with PHP code.

Check Out Our Video Guide on How To Redirect WordPress Users After Login

Why Redirect WordPress Users After Login?

By default, all users are directed to the admin dashboard after logging in. While they’ll only be able to see and interact with parts of the dashboard they have access to (subscribers will only be able to edit their profile, for example), this still isn’t always desirable behavior.

Depending on the type of site you run, it may make more sense to send new logins somewhere else. You may even want users of different roles to be redirected to different pages entirely (admin to the dashboard, users to the homepage, and so on).

A few examples of what you might want to change:

  • Avoid any interaction with the back end by directing users straight to the homepage.
  • Send users to their public profile page.
  • Send them back to the page they were on before they logged in.
  • For membership sites, send logged-in users to the page you keep your locked articles or videos behind.
  • For forums, send users to the main forum page.
  • For ecommerce sites, send shoppers to the store page, their wishlist, their shopping cart, etc.

Many themes and plugins may change this as well. Maybe you’ve noticed that users are suddenly being redirected to the homepage on login and want to change it back.

While this is a small UX element and many websites will likely never notice or change it, it can have a surprisingly large impact on your users, making navigating your site a little less disorienting.

Unfortunately, there’s no setting to change the login redirect page built into WordPress. If you want to send your users somewhere else, you’ll have to either use a plugin or code it yourself (or, if you’re using Kinsta hosting, use our built-in redirect rules). Luckily we’re here to walk you through the process.

How To Redirect WordPress Users After Login: 2 Methods

Ready to make this small yet crucial change? You have two options: Download a plugin, or change your website’s code.

Coding it yourself definitely does have some pros. If you’re proficient in PHP, you have full control over how the login redirect acts. You don’t need to rely on plugins that might not accomplish what you need, and you also won’t have to bog down your site with more plugins.

On the other hand, not everyone knows how to code, and one wrong line can really mess up your site, so it’s not recommended for beginners to handle this manually. Plugins are much easier to use and require less trial and error to make sure your code is working properly.

Kinsta does offer the best of both worlds with redirect rules, which let you set up page redirects without a plugin or code.

Otherwise, it’s recommended that you just install a plugin until you’re comfortable enough with code to write it yourself.

Redirect Using a Plugin

Plugins are a quick way to get things done with just a little easy setup. Here we’ve picked out three of the best ones you can use to edit your login redirect URL.

These aren’t the only plugins with this functionality; for example, WPForms (with its User Registration Forms addon) and WP User Manager also provide login redirects along with all their other features.

Some themes will also change the redirect page, but it’s hard to search specifically for ones that do this.

But these three plugins are dedicated primarily to login redirects. They’re small files and won’t add any unnecessary features.

LoginWP

LoginWP plugin. 
LoginWP

The first plugin is LoginWP, which gives you the ability to set redirect rules for specific users and roles as well as change the user registration redirect.

The pro version integrates with over a dozen different plugins and, most notably, lets you redirect users back to the page they logged in on. If that’s what you’re aiming for, you’ll either have to pay or try a different plugin.

Otherwise, LoginWP is free to use and powerful yet simple with its redirect rules.

To get started, install LoginWP from Plugins > Add New, then look for the new LoginWPmenu item in your sidebar. Navigate to LoginWP > Redirections.

Setting up redirection rules with the LoginWP plugin.
Setting up redirection rules with the LoginWP plugin.

There are several settings you can change here but look to the All Other Users heading and the Login URL option. Change this to the URL you want and click Save Changes. This will apply to all logged-in users.

What if you want to set up a conditional URL redirect, like for certain user roles? In that case, click the Add New button to set up a redirect rule. You can set up rules based on individual users, roles, and even certain user capabilities that might span multiple roles.

Establishing conditional rules with the LoginWP plugin.
Establishing conditional rules with the LoginWP plugin.

Set the Order so that if two of your rules conflict, the one with the lowest number will take priority. Then put the URL you want to redirect to in the Login URL box and click Save Rule.

Easy as that. You can use these rules to exempt admins from global redirect rules or direct certain users to a special page.

Sky Login Redirect

Sky Login Redirect plugin
Sky Login Redirect

For a free plugin, Sky Login Redirect is very powerful. This alone lets you set redirect rules, customize your login page’s appearance, and enable small tweaks like automatically checking the “Remember Me” box or removing certain links on the page.

The pro version integrates with several plugins like WooCommerce or Easy Digital Downloads and also adds extra optional features like content restriction.

Once you install Sky Login Redirect, go to the new Login Redirect sidebar link and make sure you’re on the Redirects tab. Click Add Entry to get started.

Setting up redirect logins and logouts in the Sky Login Redirect plugin
Setting up redirect logins and logouts in the Sky Login Redirect plugin.

Choose whether to redirect all users, a specific user, or a specific role. Then choose whether to redirect logins and logouts to the previous page, a specific page/URL, or just to the WordPress admin page.

Drag and drop your rules to change the order your redirect rules execute (such as when users have multiple roles that apply). Lower numbers have higher priority, so set user-specific ones first and more general ones last.

When finished, click Save Changes in the top right corner.

If you want to make user- or role-specific rules, you’ll also need to set up an extra rule to apply to the rest of your users – even if it’s just keeping the default behavior of redirecting to the admin page.

WP Login and Logout Redirect

WP Login and Logout Redirect plugin.
WP Login and Logout Redirect

If you’re looking for the simplest, smallest plugin possible, WP Login and Logout Redirect might be the one. You might not be interested in any of the extra features offered by the other two plugins, and this one gets straight to the point.

Upon installation, you’ll find the new Redirect Options menu in your sidebar. Click it, and you’ll see two boxes: Login Redirect URL and Logout Redirect URL. Put the URL you want in and click Save Changes, and you’re done.

Redirect options in the WP Login and Logout Redirect plugin
Redirect options in the WP Login and Logout Redirect plugin.

The plugin also adds one additional feature: On Users > All Users, you’ll see a new Last Login which will show you the last day and time the user logged in. It’s a small but nifty extra.

Redirect Using Custom Code

If you’d prefer not to use a plugin, the plugins aren’t working for you, or you want to do something they can’t handle, then you might need to write your own custom code. This is only recommended for advanced users and those familiar with PHP. Of course, you can always hire a developer if you’re not comfortable.

Before inserting and executing code, you should back up your website – just in case. If something goes wrong, like you end up in maintenance mode or get stuck in an endless redirect loop, you can always restore a backup.

To write your own custom redirect code, you should familiarize yourself with the login_redirect filter. This page will explain how the filter works, and there are a few examples of how to apply this knowledge in the comments.

Here’s a very simple example to get you started:

function custom_login_redirect() {

return 'home_url()';

}

add_filter('login_redirect', 'custom_login_redirect');

This code will cause all users to be redirected to the homepage when they log in to your site. That’s all it does! If you want, you can change “home_url()” to a URL of your choosing. For example, replacing ‘home_url()’ with ‘/blog’ will direct users to your site’s blog page.

Now that you have your code, where to put it? You have two options here: The first is to edit your theme files directly, and the second is to use a plugin that lets you insert code.

If you choose to edit theme files, you should first make a child theme, or you may find that your redirect rules have suddenly disappeared the next time WordPress or your theme updates.

While you can edit WordPress files through FTP or a code editor, this isn’t necessary. WordPress comes with a built-in file editor right there in your dashboard. Start by going to Appearance > Theme File Editor. In the Theme Files sidebar on the right, look for Theme Functions (functions.php) and click it. Scroll to the bottom and drop the code above in there. Then click Update File.

After this, test it out by logging out and back in. Everything should be working as expected.

If you don’t want to deal with child themes, an easier option is to install a plugin that lets you insert code. For this, we’ll use Code Snippets.

Code Snippets plugin
Code Snippets

One big benefit here is that if you ever want to edit your code or quickly disable it, it will be very easy to find. Each code snippet is contained on its own, easily accessible page.

Install the Code Snippets plugin, then head over to Snippets > Add New. Make sure you’re on the Functions tab, then paste your code or our example in. Leave it on Run snippet everywhere. Click Save Changes and Activate when you’re finished.

Adding a new snippet using the Code Snippets plugin
Adding a new snippet using the Code Snippets plugin.

Whichever method you choose, you should notice the new login rules working perfectly.

Finally, if you’re not comfortable with code but don’t want to use a plugin, you can try Kinsta’s redirect rules. This is most appropriate when you’re trying to redirect all users away from /wp-admin entirely, such as if you’re using a separate dashboard.

This will affect you as well as everyone else, so be careful and make sure to test your new rule out. You should also use the HTTP Status and Redirect Checker to make sure everything is working properly.

Summary

User experience is a crucial part of web design. It might not seem that important, but the page your users end up on when they log in can have a big impact. You can use it to direct them to the places you want them to go or to prevent confusion and save them time.

If WordPress’ default login redirect rules aren’t cutting it, then you can set them yourself, either manually or with a plugin. The latter is the easiest, but each method has its benefits.

And don’t forget about Kinsta’s redirect rules within MyKinsta. This can save you from having to download a plugin or learn PHP just to make a small change. Speaking of redirects, if you want access to Kinsta hosting and all its benefits, we offer unlimited free migrations on all plans.