[php]
/** * WordPress function for redirecting users on login based on user role */ 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 );
[/php]
Related Articles
- Fix Elementor fixed Background sizing
- Cronjob Überlappung verhindern – flock()
- WordPress Update Hinweise deaktivieren
- WP Download Manager "attached file is missing/deleted" Fehler
- WordPress Staging: Uploads Ordner von Production Seite einlesen (per htaccess)
- WC Attribute Komma durch Linebreak ersetzen
- Profile Builder Pro add multiple user roles on register form
- Profile Builder Pro User Listing Filter by multiple meta key values
- Resize anstatt Crop von Avatar Bildern in Profile Builder Pro
- Current User link shortcode Profile Builder Pro