Can I change the category of If-So cookies?

Yes. You can change the category of specific If-So cookies by using a simple WordPress filter. This is useful if you want better control over how cookies are classified for consent management or compliance tools.

To do this, add the following code to your theme’s functions.php file (or to a custom plugin):

add_filter('ifso_cookie_category', function($ctype, $cname) {
    if ($cname === 'MY_NECESSARY_COOKIE') {
        return 'necessary';
    }
    return $ctype;
}, 10, 2);

In this example, the cookie named MY_NECESSARY_COOKIE is explicitly assigned to the necessary category. All other cookies will keep their original category.

Available cookie categories

You can assign cookies to any of the following categories:

  • necessary
  • statistics
  • marketing
  • preferences

This allows you to align If-So cookies with your site’s cookie consent logic and ensure they are handled correctly by your consent management solution.