Issue related to _wpnonce

enter image description here

I have an e-commerce website.I have used woocommerce plugin.
I have a problem with below situation

  • Login as user1 in tab1.
  • open another tab and log out from that tab2.
  • In tab2 log in as user2.
  • now go to tab1 and try to log out from that tab, it will display the
    confirmation page.
  • function smart_logout() {
        if (!is_user_logged_in()) {
    
            $smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/';
            wp_safe_redirect( $smart_redirect_to );
            exit();
        } else {
                    error_log('logout...');
            //check_admin_referer('log-out');
            wp_logout();
            $smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/';
            wp_safe_redirect( $smart_redirect_to );
            exit();
        }
    }
    add_action ( 'login_form_logout' , 'smart_logout' );
    

    I tried above code but it’s working for the same user.
    I want it for multiple users also.I don’t want to display confirmation page for security reason.
    Please help me to solve it.

    Read more here: Issue related to _wpnonce

    Leave a Reply

    Your email address will not be published. Required fields are marked *