# Personal After-Login Page for Each User

> Adds an "After login, go to" field to each user's profile so administrators can send specific clients or members to their own page when they log in.

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

## Code

```php
add_action( 'edit_user_profile', function ( $user ) {
    if ( ! current_user_can( 'edit_users' ) ) {
        return;
    }

    wp_nonce_field( 'wpide_user_landing_' . $user->ID, 'wpide_user_landing_nonce' );
    echo '<h2>After login</h2><table class="form-table" role="presentation"><tr><th scope="row"><label for="wpide-user-landing">Go to page</label></th><td>';
    wp_dropdown_pages( array(
        'name'              => 'wpide_user_landing',
        'id'                => 'wpide-user-landing',
        'selected'          => (int) get_user_meta( $user->ID, 'wpide_user_landing', true ),
        'show_option_none'  => 'Default destination',
        'option_none_value' => 0,
        'post_status'       => array( 'publish', 'private' ),
    ) );
    echo '</td></tr></table>';
} );

add_action( 'edit_user_profile_update', function ( $user_id ) {
    if ( ! isset( $_POST['wpide_user_landing_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['wpide_user_landing_nonce'] ), 'wpide_user_landing_' . $user_id ) || ! current_user_can( 'edit_users' ) ) {
        return;
    }

    $page = isset( $_POST['wpide_user_landing'] ) ? absint( $_POST['wpide_user_landing'] ) : 0;

    if ( $page ) {
        update_user_meta( $user_id, 'wpide_user_landing', $page );
    } else {
        delete_user_meta( $user_id, 'wpide_user_landing' );
    }
} );

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

    $page = (int) get_user_meta( $user->ID, 'wpide_user_landing', true );

    return $page && get_post_status( $page ) ? get_permalink( $page ) : $redirect;
}, 30, 3 );
```

## Notes

Only administrators can set the page. Users without one keep the normal login destination.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Personal After-Login Page for Each User" 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/
