• Resolved aculine

    (@aculine)


    Hi, I need to destroy age_gate cookie (used on all content) when user logout from Woocommerce.
    I’ve tried both with PHP and Javascript, but when go to home, age_gate is already approved.
    How can I do?

    thank you
    Luca

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @aculine,

    This is possible if you use the wp_logout hook, just add the below to your themes functions.php

    
    /**
     * Clear Age Gate on logout
     */
    add_filter('wp_logout', 'clear_agegate');
    
    function clear_agegate(){
      setcookie("age_gate", 0, 1);
    }
    

    Thanks
    Phil

    Thread Starter aculine

    (@aculine)

    Thank you @philsbury, it works perfecty!

    L.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“exit” button’ is closed to new replies.