pressidium/pressidium-cookie-consent

Hide a cookie category if it’s empty

over-engineer opened this issue · 2 comments

When a cookie category doesn’t contain any cookies, it shouldn’t be displayed in the settings modal.

Not all websites set cookies of every cookie category.

(originally suggested by @nikodemsky on the WordPress.org support forum)

+1 on this

Just a thought that crossed my mind when inspecting the code: this might give issues with the new GCM mode, as the consent parameters depend on the categories in the getConsentStatesByCategories() function. If those categories are hidden because there are no cookies, and thus cannot be accepted, the consent can never be granted for those parameters. I am not sure if this is an issue, though.

This was addressed in 1.5.0, which was just released on the WordPress Plugin Directory.

A new option, Hide empty categories, is available in the “General” tab.

To enable it:

  1. Go to wp-admin
  2. Click on “Cookie Consent”
  3. Navigate to the “General” tab
  4. Under “Configuration,” switch “Hide empty categories” on

I’m closing this issue as resolved.


If those categories are hidden because there are no cookies, and thus cannot be accepted, the consent can never be granted for those parameters. I am not sure if this is an issue, though.

@skrypt-nl This shouldn’t be a problem since a category must have no cookies to be hidden. So, I believe that lack of consent for that category won’t affect anything. If you later add cookies to that category and the “Re-consent” option is enabled, users will be prompted to re-consent. If there’s anything I overlooked, please let me know.