wp_logout() changes in WordPress 5.1.1

We’ve recently just upgraded our WordPress site to 5.1.1 After the upgrade, we’ve started encountering issues when executing the wp_logout() function of WordPress. Somehow we’re getting a 302 response but there is no error/warning being shown. I’ve narrowed it inside the wp_logout() and determined that both wp_destroy_current_session(); and wp_clear_auth_cookie(); are working fine! This means that … Read more

Logout redirects to a broken page(home URL is omitted)

I’m using the latest version of WP. I have a problem, where clicking the logout button from the admin panel redirects to a completely broken link: http://wp-login.php/?loggedout=true As you can see, the domain is completely omitted from the link(in my case it’s wp.localhost) I will mention that this local WP site was “cloned” from a … Read more

Logout issue with new Domain on WP Multisite

I’m using a multisite and I set my site up at parentsite.com/mysite. When the logout button was clicked it worked correctly and logged the users out and brought them back to the homepage. Here’s what the code was: <a class=”logout with-icon” href=”https://wordpress.stackexchange.com/questions/114049/<?php echo wp_logout_url( get_permalink() ) ?>” data-icon=”&#xf08b;”><?php _e(‘Log out’, ‘franklin’) ?></a> Then I bought … Read more

How do you log a user out with wp_logout?

I can get wp_logout to work, but not without generating lots of warnings (‘PHP warning: Cannot modify header information – headers already sent’). wp_logout calls wp_clear_auth_cookie, which calls setcookie, and the cookies have to go with the HTTP headers. I’m calling wp_logout inside the page (in the header or footer), hence the problem. So, how … Read more