Forums

Clear cookies in WordPress (3 posts)

  1. alexvorn2
    Member
    Posted 2 years ago #

    I want to clear the cookies so I use this code:

    <?php
    function wp_clear_auth_cookie() {

    do_action('clear_auth_cookie');
    }

    wp_clear_auth_cookie();
    ?>

    but an error occurs, what I'm doing wrong?
    Please Help!

  2. Brandon Allen
    Member
    Posted 2 years ago #

    Where do you plan on using this? If you just want to clear your cookies, you can do this through your browser.

    What you're doing wrong is creating a function that already exists. Then you made the plugin hookable using a hook that already exists. You also didn't tell that function to do anything. All you need to is call the function where you need it. Just
    wp_clear_auth_cookie();
    and you're done.

  3. leahs2
    Member
    Posted 1 year ago #

    Where do I put
    wp_clear_auth_cookie();

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic