• Resolved aangel8

    (@aangel8)


    is there a way to perform the logout progmatically? I’m trying to create a button that logs the user out and redirects to a custom URL but I do not want the user to redirect every time they logout, ONLY when they click this custom button.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    This is more a core Ultimate Member question, but I think what you want is possible with one of the filters Ultimate Member provides. This filter returns the URL the user is redirected to after logging out. The result would look something like this:

    add_filter( 'um_logout_redirect_url', 'umnm_redirect_logout', 10, 2 );
    function umnm_redirect_logout($url, $user_id){
        if (isset($_POST['custom_logout_button'])){
            return 'https://my_custom_redirect_url.com';
        }
        return $url;
    }
    Thread Starter aangel8

    (@aangel8)

    excuse my lack of knowledge in coding but is this added in the functions.php file or is this html that can be placed into an object?

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    This can be placed in your functions.php.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Perform Logout function’ is closed to new replies.