• Resolved rinh

    (@rinh)


    Hi!

    I have the Logout option for all roles to a custom URL. If logging out directly from WP Admin dashboard the redirect doesn’t work and the user ends up on WordPress default login form.

    Thank you in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @rinh,

    The redirect to a custom URL will only apply when logging out on your site.
    You can check this articleto know more about UM Logout.

    • This reply was modified 2 years, 8 months ago by gelieys.
    Thread Starter rinh

    (@rinh)

    That’s unfortunate, but thank you regardless.

    Thread Starter rinh

    (@rinh)

    In case anyone is looking for the same, I got help rewriting my redirect function so it can redirect users to custom URLs based on their roles.

    function redirect_after_logout( $user_id ) {
        $current_user = get_user_by( 'id', $user_id );
        $role_name    = $current_user->roles[0];
        
        if( $role_name == 'A_ROLE' ) {
            wp_safe_redirect( site_url( 'URL_WHERE_EVER_YOU_WANT_TO_REDIRECT' ) );
            exit;
        }
        
        if( $role_name == 'ANOTHER_ROLE' ) {
            wp_safe_redirect( 'URL_WHERE_EVER_YOU_WANT_TO_REDIRECT' );
            exit;
        }
    }
    add_action( 'wp_logout', 'redirect_after_logout' );
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @rinh

    Thanks for letting us know your solution to resolve the issue. I’m marking this topic as resolved now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Logout redirect not working when logging out from WP Admin’ is closed to new replies.