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 the error happens when the last line in wp_logout()
is called:
do_action( 'wp_logout' );
My question is:
Is it possible to for external plugins to somehow corrupt the
wp_logout
action with functions that can break the flow and give a302
or is there anything in5.1.1
that affectedwp_logout
somehow?
add_action( 'wp_logout', function() { wp_redirect( home_url() ); die(); });
would do it.