How to redirect WordPress user on login and logout

WordPress login and logout are probably the most underrated and overlooked by website owners user experiences. The default WordPress behavior redirects user to the Backend area after login and after logout, user is redirected to the login screen (/wp-login.php). Both behaviors may not be ideal especially if user does not have access to the Backend area or after logout you simply want to redirect an user to the home page.

Luckily AAM has the ability to redefine the default WordPress behavior and you can literally define how any individual user or group or users (based on role) are redirected after login and logout events.

Login and Logout Redirect features are included in the free AAM version and do not require purchasing any premium extensions. If something is not working for you as intended, please contact me immediately.

WordPress user login and logout redirects

Both Login and Logout redirects have the same set of redirect rules that you can choose from and each are explained in more details below.

WordPress default behavior

Use the default WordPress behavior. In this case during successful authentication, an user will be redirected to the Backend dashboard page; and after logout, an user is redirected back to the login screen (/wp-login.php).

Redirected to an existing page

Redirect the authenticated user to an existing page on the Frontend area. Very useful option that significantly improve user experience, especially if you want to redirect user to the home page or any other meaningful page on the Frontend.

WordPress redirect user to home page

Please note! Make sure that you do not restrict access to the page that you are redirecting user to. Otherwise AAM will redirect user based on the Access Denied Redirect rule.

Redirected to the URL

Redirect the authenticated to any valid URL that can be even a completely different website. This option is quite popular for websites that have some static pages or embedded third party applications.

WordPress redirect to URL

Provide the valid full URL to the page (including http or https protocol), otherwise AAM may not be able to redirect user to the specified invalid URL. For example

Trigger PHP callback function

The final option is more for developers that prepare a custom callback function that may handles redirect or execute any additional steps right after user was logged in or logged out. You absolutely must have to provide valid PHP callback otherwise user will see a blank screen.

WordPress custom callback redirect

Here is the example for the callback function:

 * Custom login/logout redirect callback
class MyLoginRedirect {
     * Manage redirect
     * @access public
     * @static
    public static function trigger() {
        //place your custom code here


Login and Logout redirect are very important parts of the great user experience. They always have to be optimized to provide intuitive and smooth flow for user that has just authenticated or logged out.

With the AAM plugin you have possibility to customize login and logout redirect for any role or even individual user and what is even better – it is absolutely free feature.

Related Forum Topics

Get notified about important updates and new features (no more than one email per month).