# BuddyPress: Send Members to Their Profile After Login

> Sends members to their own BuddyPress profile (or activity stream) after logging in, instead of the WordPress dashboard.

- Type: PHP
- Runs: Run everywhere
- Category: [Users](https://wpide.com/library/category/users/)
- Tags: buddypress, login, redirect
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/buddypress-login-redirect-to-profile/

## Code

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

// "profile" or "activity".
$wpide_bp_login_target = 'profile';

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

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

    if ( 'activity' === $wpide_bp_login_target && bp_is_active( 'activity' ) ) {
        return bp_get_activity_directory_permalink();
    }

    $url = function_exists( 'bp_members_get_user_url' ) ? bp_members_get_user_url( $user->ID ) : bp_core_get_user_domain( $user->ID );

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

## Notes

Set $wpide_bp_login_target to "activity" to land on the site-wide activity stream. Staff who can edit posts still go to wp-admin.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "BuddyPress: Send Members to Their Profile 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/
