Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: [Resolved] Redirect from members page to profile page

@bridieamelia

Participant

Cheers @henrywright,

I tweaked it a bit and came up with this, which does what I want it to do. It was the conditional not for bp_is_my_profile() I was missing, for future readers.

function redirect_members_page() {
    if ( is_page('members') && ! bp_is_my_profile() ) {
        $user = get_userdata( get_current_user_id() );
        wp_redirect( home_url() . '/members/' . $user->user_login );
        exit;
    }
}
add_action( 'template_redirect', 'redirect_members_page' );

Bridie

Skip to toolbar