Logout URL performing strange
This happens because of a missing nonce parameter in the URL. Every WordPress action, including login/logout, validates the nonce first, to make sure the request comes from a known source.
This happens because of a missing nonce parameter in the URL. Every WordPress action, including login/logout, validates the nonce first, to make sure the request comes from a known source.
If you are changing the password for the current logged-in user, it will log you out. You have to log in again: // Get current logged-in user. $user = wp_get_current_user(); // Change password. wp_set_password($new_password, $user->ID); // Log-in again. wp_set_auth_cookie($user->ID); wp_set_current_user($user->ID); do_action(‘wp_login’, $user->user_login, $user); Note that since you are setting a new log-in cookie (i.e. changing … Read more
This happens because you are missing the neccessary nonce in the URL, which is being checked in wp-login.php case ‘logout’ : check_admin_referer(‘log-out’); … Use wp_logout_url in order to retreive the URL including the nonce. If you want to redirect to a custom URL, simply pass it as an argument. <a href=”https://wordpress.stackexchange.com/questions/67336/<?php echo wp_logout_url(“/redirect/url/goes/here’) ?>”>Log out</a> … Read more