# How to redirect users after login based on their role

URL: https://wpusermanager.com/article/311-how-to-redirect-users-on-login-and-registration-based-on-user-roles/
Last updated: 2026-10-15

The `wpum_redirect_after_login` filter lets you send users to a different page after they log in with the WP User Manager login form, depending on their role.

Add this snippet to a file in your `/wp-content/mu-plugins/` directory (create the mu-plugins directory if it doesn't exist):

```
<?php

add_filter( 'wpum_redirect_after_login', function( $redirect, $user ) {
	if ( ! $user instanceof WP_User ) {
		return $redirect;
	}

	if ( in_array( 'author', (array) $user->roles, true ) ) {
		return home_url( '/author-page' );
	}

	if ( in_array( 'subscriber', (array) $user->roles, true ) ) {
		return home_url( '/subscriber-page' );
	}

	// Add more conditions for each role as needed.

	return $redirect;
}, 10, 2 );
```

Change the role names (**'author'**, **'subscriber'**) to the roles on your site, and the paths (**'/author-page'**, **'/subscriber-page'**) to the pages each role should go to. Users whose role isn't listed go to the page set in Users > Settings > Redirects > After Login.

The snippet is also available as a [gist](https://gist.github.com/wp-user-manager/e00b8253c7719b7ef6ecd266495eb57e).

This filter only runs when someone logs in. After registration, users go to the page set in Users > Settings > Redirects > After Registration, which is the same for every role. See [Redirects Settings](https://wpusermanager.com/article/140-redirects-settings/).
