• I’m trying to capture the wp-generated logout link with the correct nonce. If I attach my function to the “wp_login” hook, I get the wrong nonce. If I attach it to “init” hook, it works perfectly. Ideally, I’d like my action to fire upon successful login, and not require that the user visits another WP page (they could be logging in from, and returning to, another subdomain outside of WP).

    Thanks for your help.

    -David

Viewing 1 replies (of 1 total)
  • Thread Starter David Cavins

    (@dcavins)

    More generally, I’ve got WP installed at wp.site.com, and another web site at b.site.com, and I’d like to generate a logout link so that users may log out from b.site.com successfully. Does anyone know how to generate the correct logout link upon successful login? Or even just capturing the correct nonce would solve my problem. As it is, using the hook “wp_login,” I get the generic, not-logged-in nonce.

    function create_login_cookie_local() {
       global $user;
       $logout = wp_logout_url();
       setcookie("CookieLocalLogin", $logout, time()+172800, "/", "site.com");
       }
    
    add_action('wp_login', 'create_login_cookie_local');
Viewing 1 replies (of 1 total)
  • The topic ‘Nonce problem with wp_logout_url’ is closed to new replies.