Vin Cit

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
in reply to: wp_logout_url() redirect param broken #151234

Vin Cit
Participant

Hi,

I cannot give you access to my client’s installation. Please, just review the code I posted and let me know where I’m incorrect.

Thanks.

in reply to: wp_logout_url() redirect param broken #150803

Vin Cit
Participant

Hi,

It’s not working, please test again. This is not an issue with cache/cookies as changing this line of code in you plugin fixes my use case.

So, to elaborate, when using wp_logout_url( home_url('/') ) the user is not redirected back to the site’s front page after logout. They are redirected to WP’s login page at /wp-login.php.

This is because you filter the URL returned by wp_logout_url() and change it to /?logout=<NONCE>&redirect_to=....
You then process that request parameter logout like this:

function logout()
    {

        if (isset($_REQUEST['logout']) && wp_verify_nonce(wpdm_query_var('logout'), NONCE_KEY)) {
            wp_logout();
            wp_safe_redirect(wpdm_login_url());
            die();
        }
    }

As you can see, you are completely ignoring the redirect_to parameter.

  • This reply was modified 4 years, 4 months ago by Vin Cit.
Viewing 2 posts - 1 through 2 (of 2 total)