Is there a way not to show the cookie consent message at all if somebody has cookies completely disabled in their browser? The way it works now is that the message is displayed on each page even if it was accepted before (which is obvious because the cookie cannot be stored).
Is there a way to check if cookies are disabled in the browser and if so, just don’t display the cookie consent message?
Thank you!
Hi,
Please add following code to bottom of Functions.php file in Appearance > Editor
//-------------------------------
// Hide Cookie consent when cookies are disabled on browser
//-------------------------------
function av_cookie_disabled(){
?>
<script>
jQuery(window).load(function(){
if (! navigator.cookieEnabled){
jQuery('.avia-cookie-consent').addClass('cookiebar-hidden');
}
});
</script>
<?php
}
add_action('wp_footer', 'av_cookie_disabled');
I will inform our devs regarding the issue :)
Cheers!
Yigit
Thank you, Yigit. Unfortunately this doesn’t seem to work though. I tried it on several sites and with different browsers but it’s still the same issue. I deleted the site cache and browser cache before each test, so that cannot be the problem either.
I entered one of my current child functions.php files into the private content field, so that you can check if there might be.a conflict somewhere?
Thanks!
Hi,
Not sure why it did not worked on your end, i tested it on my localhost and works fine.
Our devs fixed this issue and it will be included in Enfold 4.4.1 :)
Best regards,
Yigit
Thank you, Yigit. That’s even better since there won’t be a need to edit all functions.php files manually and it’s not an urgent issue at all.