Replies: 2
Hello,
After a successful login, I would like to redirect to a welcome page. I have tried several plugins and I have tried adding code via the Snippet plugin to accomplish this. Everything just ignores it and remains on the Login page. I have the user management plugin WP User Manager and I am thinking it is already overriding the redirect filter and that is why I can’t get it to work. I want all non-admin users to go to welcome_page and admins to function as they do now. The code snipped I attempted is:
function monnie_login_redirect($redirect_to, $request, $user) {
// Validating user login and roles.
if (isset($user->roles) && is_array($user->roles)) {
// Redirect non-admins only.
if (in_array(‘administrator’, $user->roles)) {
$redirect_to = “https://monnie.family/welcome/”;
}
}
return $redirect_to;
}
add_filter(‘login_redirect’, ‘monnie_login_redirect’, 10, 3);
The site is for registered users only, but I will provide an administrator id privately, it that will help.
Thanks for any assistance or code solution you can provide.
Kevin kdroberson@me.com