Hello, I think you don't understand me.
now, I will use role instead of membership
first, I redirect login in user based on role by this code
function user_login_redirect( $url, $request, $user ){
if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) {
if( $user->has_cap( 'administrator' ) ) {
$url = admin_url();
} elseif( $user->has_cap( 'aussteller' ) ) {
$url = home_url('/account/ausstellerbereich/');
} elseif( $user->has_cap( 'topperformer' ) ) {
$url = home_url('/account/top-performer-bereich/');
} else {
$url = home_url();
}
}
return $url;
}
add_filter( 'login_redirect', 'user_login_redirect', 10, 3 );
and it's working well.
second:
if a user is on a specific page I want to redirect him to another page (based on role)