Title: Shortcode Reset Cookie
Last modified: July 4, 2018

---

# Shortcode Reset Cookie

 *  [raffdes](https://wordpress.org/support/users/raffdes/)
 * (@raffdes)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/)
 * Qualcuno mi può spiegare come si usa lo shortcode Reset Cookie?
    A quale url 
   bisogna linkare il bottone? Grazie
 * Can someone explain to me how to use the Reset Cookie shortcode?
    Which URL should
   I link to? Thank you

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Nuovaera Comunica la tua immagine s.r.l.](https://wordpress.org/support/users/nuovaera/)
 * (@nuovaera)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10462053)
 * Put the shortcode to the cookie policy page 🙂
    The redirect link is useful only
   if you want to redirect the user to another page after the click. When you click
   the button it deletes all your domain generated cookies from the browser (but
   not the ginger-cookie).
 *  [John-Pierre Cornelissen](https://wordpress.org/support/users/jpnl/)
 * (@jpnl)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10514186)
 * So since it doesn’t delete the Ginger cookie it doesn’t do what it should do.
 * Use case: someone has visited my site and accepted cookies. He changes his mind,
   resets/deletes the cookies and continue browsing the site. Because it didn’t 
   delete all the ginger cookie all cookies are saved again.
 *  [maxtrend](https://wordpress.org/support/users/maxtrend/)
 * (@maxtrend)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10707490)
 * How can this reset button problem be solved?
    [ginger_reset_cookie class=”” text
   =”” redirect_url=””]
 * Thanks
    Cesare
 *  [xxxsimoxxx](https://wordpress.org/support/users/xxxsimoxxx/)
 * (@xxxsimoxxx)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10707532)
 * I’ve solved with this javascript (not mine, it’s a mix of stuff from various 
   blog).
 * <script>function deleteAllCookies(){for(var e=document.cookie.split(“;”),o=0;
   o<e.length;o++){var i=e[o],n=i.indexOf(“=”),t=n>-1?i.substr(0,n):i;document.cookie
   =t+”=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;domain=”,document.cookie
   =t+”=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;domain=”+location.hostname.
   replace(/^www\./i,””)}}</script>
 * It deletes every cookie from your domain.
 *  [maxtrend](https://wordpress.org/support/users/maxtrend/)
 * (@maxtrend)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10707788)
 * Thanks!
 *  [Salentomane](https://wordpress.org/support/users/salentomane/)
 * (@salentomane)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10774989)
 * Excuse me where did you insert javascript? How does it work? Can you explain 
   me better? Thank you
 *  [xxxsimoxxx](https://wordpress.org/support/users/xxxsimoxxx/)
 * (@xxxsimoxxx)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10775022)
 * Very quick & dirty… added a shortcode in the theme. But it could be very easy
   to create a plugin to do so, or insert javascript directly in the content (define(‘
   CUSTOM_TAGS’, true ); and then put the button in code).
 *     ```
       add_shortcode('ge_delcookie', 'ge_delcookie');
       function ge_delcookie( $atts, $content = null ) {
       	$thesctipt='---script abobe---';
       	return $thesctipt.'<button class="" onclick="deleteAllCookies()">PRESS TO DEL COOKIES</button>' ;
       }
       ```
   
 *  [Salentomane](https://wordpress.org/support/users/salentomane/)
 * (@salentomane)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10775194)
 * have addedd in file function:
 * add_shortcode(‘ge_delcookie’, ‘ge_delcookie’);
    function ge_delcookie( $atts,
   $content = null ) { $thesctipt='<script>function deleteAllCookies(){for(var e
   =document.cookie.split(“;”),o=0;o<e.length;o++){var i=e[o],n=i.indexOf(“=”),t
   =n>-1?i.substr(0,n):i;document.cookie=t+”=; expires=Thu, 01 Jan 1970 00:00:00
   GMT; path=/;domain=”,document.cookie=t+”=; expires=Thu, 01 Jan 1970 00:00:00 
   GMT; path=/;domain=”+location.hostname.replace(/^www\./i,””)}}</script>’; return
   $thesctipt.'<button class=”” onclick=”deleteAllCookies()”>Delete Cookie</button
   >’ ; }
 * Have added in privacy and cookie policy page: [ge_delcookie]
 * but it does not work. Any suggestions?
    -  This reply was modified 7 years, 7 months ago by [Salentomane](https://wordpress.org/support/users/salentomane/).
 *  [xxxsimoxxx](https://wordpress.org/support/users/xxxsimoxxx/)
 * (@xxxsimoxxx)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10780296)
 * Does the button shows up?
 *  [Salentomane](https://wordpress.org/support/users/salentomane/)
 * (@salentomane)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10780703)
 * Yes, button appears but nothing happens if I click
 *  [xxxsimoxxx](https://wordpress.org/support/users/xxxsimoxxx/)
 * (@xxxsimoxxx)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10780729)
 * You could check for js errors with the browser’s inspector…
    and try to run the
   code manually from the browser’s console.
    -  This reply was modified 7 years, 7 months ago by [xxxsimoxxx](https://wordpress.org/support/users/xxxsimoxxx/).

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Shortcode Reset Cookie’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ginger_ff6033.svg)
 * [Ginger - EU Cookie Law](https://wordpress.org/plugins/ginger/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ginger/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ginger/)
 * [Active Topics](https://wordpress.org/support/plugin/ginger/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ginger/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ginger/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 11 replies
 * 6 participants
 * Last reply from: [xxxsimoxxx](https://wordpress.org/support/users/xxxsimoxxx/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/shortcode-reset-cookie/#post-10780729)
 * Status: not resolved