Support » Plugin: Cookie Notice for GDPR » Notice doesn’t disappear on accept / refuse

  • Resolved geertvanderheide

    (@geertvanderheide)


    The plugin works well for me on several sites, but something’s wrong on one site (links below). The notice is shown properly, I can click accept or refuse (in Dutch), if I accept the cookies are placed including the cookie “cookie_notice_accepted” with value “true”, but somehow the notice still shows up on every page load, regardless of whether I accept or refuse.

    Site with the problem: https://www.np-aldefeanen.nl
    Site on same hosting with same plugin but no problem: https://www.elkevistelt.nl

    Neither site is using any caching or minification plugins, and the themes are well-built. I’ve checked all the settings and have tried re-installing the plugin to no avail. There are no errors in the console and I’m using the latest plugin version.

    What could be causing this?

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi Geert,

    I can tell you are using WPLM.
    I am not sure how this cookie notice plugin works with multilingual sites.

    It would not surprise me if the cookies get confused by it?
    Have you tried disabling wplm for a while to see if this still happens in that scenario? The fact that your other site ( NOT multilangual! ) is not having this problem, also seems to point in this direction…

    Always take a backup before testing please, and better yet, migrate a copy/backup to a subfolder so you can try out stuff without messing up your site!

    If this issue goes away as soon as wplm is out of the combo, I suggest you go to their forum and ask for help.

    I found this topic on WPLM, but did not get any wiser unfortunatelly:
    https://wpml.org/forums/topic/gdpr-compliance/

    • This reply was modified 9 months, 3 weeks ago by  LogoLogics.

    Thank you LogoLogics for pointing towards WPML. That is indeed the biggest difference between the two sites and this cookie plugin isn’t officially compatible with WPML. On the other hand, I have been able to translate the cookie notice through WPML, and other users here are also using the plugin with WPML. Even still, it may be the cause of the acceptance state not being properly set somehow.

    I have another WPML site that will need a cookie notice, so I’ll probably try another cookie plugin for that and see how it goes.

    I did notice that the plugin also sets css body classes (“cookies_not_set”, “cookies_set”, “cookies_accepted”, “cookies_refused”, whichever apply). I can use that to hide the notice through the theme’s stylesheet, practically solving the problem… but it’s more of a workaround.

    If anyone has any more suggestions regarding this problem, please let me know.

    Update: Problem solved. Turns out I just forgot that I removed the plugin’s own stylesheet through my functions.php, and that stylesheet was hiding the notice when needed. Now I just hide it through my own stylesheet and everything works fine.

    So for anyone else: if you remove the plugin’s stylesheet for optimization or to put the styles in your own stylesheet, then be sure to show / hide the notice using the css body classes that the plugin sets.

    Hey @geertvanderheide

    I have the following problem:

    When a user accepts the cookies on a different page than the homepage, it saves the path of that page in the path of ‘cookie_notice_accepted’ (for example /en/contact). This means the user will get the cookie notice on every other page he visits until he has accepted cookies on all pages.

    Only when the user accepts the cookies on the homepage and the path is saved as / or /en, it works fine for all pages and the notice doesn’t show up again.

    Do you have the same behaviour on your page using WPML?

    Thanks in advance for your help!

    Hey @joelschmid,

    That’s not the specific problem I’ve run into. On the sites I’m using, the cookie always has the base domain set correctly, without a path, so that it applies to all pages of the site. Weird how that doesn’t seem to be happening for you.

    Looking at the code for this cookie plugin, it looks like it’ll use a constant for the cookie domain if it’s set. So please try adding this to your wp-config.php:

    define( 'COOKIE_DOMAIN', 'yourdomain.com' );

    Replacing ‘yourdomain.com’ with your own of course. I never had to do this, but it might help in your case. If your project is a WordPress multi-site then this will not work, but for a normal single site it may help.

    @geertvanderheide
    Hey thanks so much for your detailed feedback! Much appreciated!
    Hmm actually it is a wordpress multisite, any idea how I could resolve this issue? Is it possible to define a variable depending on the site?

    I’m not sure how to solve this for multi-site, or why the cookie domain doesn’t just work out of the box for you like it does for others.

    Here are some things you can try though, from others with this isssue:

    https://danielbachhuber.com/2016/07/07/fixing-cookie_domain-for-mapped-domains-on-multisite/

    https://wordpress.stackexchange.com/questions/259839/cookies-in-multisite-where-network-sites-have-their-own-domain-name

    I’d suggest trying some of the snippets provided in those links, and removing them again if they don’t work. Remember to delete cookies often when testing, and if you are using a caching plugin it may also be involved (maybe try with it disabled). If nothing works then it may be an issue with your hosting configuration, in which case I’d ask your host about it.

    Unless the author of this plugin has any more suggestions. I’m out of ideas – good luck!

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