Hot answers tagged

3

If you create a custom link in your menu, set the label to “Logout”, and set the URL to http://yourdomain.com/wp-login.php?action=logout. Then add this function to your functions.php file: function change_menu($items){ foreach($items as $item){ if( $item->title == "Logout"){ $item->url = $item->url . "&_wpnonce=" . ...


2

Found the answer. It is a bug in WordPress v5.2.3 affecting WordPress in Windows environments. Caused by backslashes in Windows paths that aren't stripped correctly Details here: https://core.trac.wordpress.org/ticket/47980 I have tried the patch suggested and can confirm it solves the problem. replace: $location = '/' . ltrim( $path . '/', '/' ) . $...


1

There's no need to regenerate the logout URL (the $logout_url part in your code) because the first parameter passed to your function is already the logout URL. So basically, just rename that $force_reauth to $logout_url and remove the $logout_url = wp_nonce_url( ... );: function my_custom_logout_url($logout_url, $redirect=null){ // rename the $force_reauth ...


1

I used this code in wordpress functions.php, to auto logout customer/user after payment in woocommerce or close the browser function logged_in( $expirein ) { return 6; // 6 in seconds } add_filter( 'auth_cookie_expiration', 'logged_in' ); function wp_logout2() { wp_destroy_current_session(); wp_clear_auth_cookie(); /** * Fires after a ...


1

A lot has changed in 5.1/5.1.1, but the changes I'm seeing in WordPress core wouldn't cause 302 redirects on their own. 1. wp_logout is pluggable wp_logout is a pluggable function. That means anyone can override this function and cause it to do something different because the function is wrapped in a condition checking for other functions with the same ...


Only top voted, non community-wiki answers of a minimum length are eligible