• Resolved wpksasa

    (@wpksasa)


    I need to know if there is a way to make the page refresh when user clicks on the link generated by the [delete_cookies] shortcode. This would help users to understand that something really happened. By default seems that nothing changes.
    Thanks.

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

    (@webtoffee)

    Hi @wpksasa,

    We can help you out with custom code. Please copy below code to your active theme’s functions.php

    function refresh_on_delete_cookies()
    { if(class_exists('Cookie_Law_Info')) {
    ?>
    <script>
    jQuery('.cookielawinfo-cookie-delete').on('click',function(){
    window.location.reload(true);
    });
    </script>
    <?php
    }
    }
    add_action('wp_footer','refresh_on_delete_cookies');

    Hope this helps.

    • This reply was modified 5 years ago by Jan Dembowski. Reason: Deleted review link
    Thread Starter wpksasa

    (@wpksasa)

    Thank you, it works like a charm!
    I didn’t put it directly in functions.php, but in footer.php, after wp_footer();, so I could add condition to print it only in the privacy page.

    <? if (is_page('privacy')) { ?>
        <script>
        jQuery('.cookielawinfo-cookie-delete').on('click',function(){
        window.location.reload(true);
        });
        </script>
    <? } ?>

    EDIT: have already rated the plugin with 5 stars ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘delete_cookies shortcode and page refresh’ is closed to new replies.