# Tutor LMS: Land on the Tutor Dashboard After Logging In

> Sends students who log in through wp-login.php to the Tutor LMS dashboard instead of the WordPress admin profile.

- Type: PHP
- Runs: Run everywhere
- Category: [Courses & Community](https://wpide.com/library/category/learning/)
- Tags: tutor, login, redirect
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/tutor-login-redirect-to-dashboard/

## Code

```php
if ( ! function_exists( 'tutor_utils' ) ) {
    return;
}

add_filter( 'login_redirect', function ( $redirect, $requested, $user ) {
    if ( ! $user instanceof WP_User || user_can( $user, 'edit_posts' ) ) {
        return $redirect;
    }

    if ( $requested && false === strpos( $requested, admin_url() ) ) {
        return $redirect;
    }

    $dashboard = tutor_utils()->tutor_dashboard_url();

    return $dashboard ? $dashboard : $redirect;
}, 10, 3 );
```

## Notes

Staff who can edit posts still go to wp-admin, and explicit redirect_to links are respected.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Tutor LMS: Land on the Tutor Dashboard After Logging In" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
