admin管理员组

文章数量:1123931

I'm having a problem with nonce verification. The theme I'm using has an AJAX login form that has nonce as a hidden field. It normally goes to my account page after a logout, and I can re-login from there or go back to home page and use the AJAX login form again, but I want it to go to the homepage after a logout, so I added the following action hook:

add_action('wp_logout','auto_redirect_after_logout');
function auto_redirect_after_logout(){
    wp_redirect( home_url() );
    exit();
}

This is were the problem started. When I logout and am redirected to the homepage, using the AJAX login form again gives me an error - which I found out to be a nonce verification failure. If I refresh the page or navigate to another page before logging in, everything works fine. Your help in fixing this problem is much appreciated.

本文标签: ajaxNonce verification problem when logging in after a logout