Support » Plugin: CookieYes | GDPR Cookie Consent & Compliance Notice (CCPA Ready) » [delete_cookies] shortcode isn’t doing what your documentation states

  • Resolved alexbesnier



    And firstly thank you for your work on this plugin, which is the best i’ve found so far. It is the only one that has a free version and that actually works !

    In your documentation on shorcodes :

    You say that the [delete_cookies] shortcode “adds a link that when clicked upon deletes all the cookies that are specified in the plugin as a non-necessary cookie.”

    It does not 😉 It only deletes the main cookie of the plugin.

    I would like to do what was suggested in your documentation an delete all the cookies (at least the ones related to my domain name) and then refresh the page as I saw the possibility in this other topic :

    Would you have some javascript I could add to the refresh script to do delete all the cookies ?


    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter alexbesnier


    And while I think about it :
    Another reason to delete ALL the cookies is that it will also reset the user consent for the different categories.
    Which is what the user should get when he wants to revise his consent : the different category checkboxes should be reinitiated.

    Plugin Author webtoffee


    Hi @alexbesnier,

    Thanks for the feedback. We will improve the delete shortcode functionality such that it would reset all plugin cookies.

    Thread Starter alexbesnier


    FYI, I’ve found that the code already exists in your plugin but doesn’t seem to work so this is not a new feature but more like a bug…

    This is what I found in /plugins/cookie-law-info/public/jscookie-law-info-public.js and there is indeed a loop that should delete all cookies :

    		this.delete_link.on("click", function(e) {
    	        for(var k in Cli_Data.nn_cookie_ids) 
    	        return false;
    Thread Starter alexbesnier


    And while waiting for an update on the plugin I’ve found a solution that works for me.
    It’s based on the code found in this other topic :

    To which I added some code to delete all cookies.
    So if you want to make it work just put the following code in your function.php Child theme file :

    function delete_all_cookies_and_refresh(){
        if(class_exists('Cookie_Law_Info')) {
                var cookies = document.cookie.split(";");
                function deleteCookie(cookiename){
                    var d = new Date();
                    d.setDate(d.getDate() - 1);
                    var name=cookiename;
                    var domain=window.location.hostname;
                    var path="";
                    document.cookie = name + "=; expires=" + d + "; path=" + path + "; domain=" + domain ;
                for (var i = 0; i < cookies.length; i++){
                    var spcook =  cookies[i].split("=");

    The only thing is that it can’t work (for reasons I don’t fully understand) if your site is on a subdomain like “”, but if it’s just “” it works like a charm.

    I’ve decided to get rid of the “revisit content” shortcode in my footer and just keep the [delete_cookies] as it now does it all :
    – deleting all cookies,
    – refreshing the page,
    – and showing the consent window again with all settings reset.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.