# LifterLMS: Send Students to Their Dashboard After Login

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

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

## Code

```php
if ( ! function_exists( 'llms_get_page_url' ) ) {
    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 = llms_get_page_url( 'myaccount' );

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

## Notes

Staff who can edit posts still go to wp-admin, and an explicit redirect_to link is respected.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "LifterLMS: Send Students to Their Dashboard After Login" 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/
