• If you do not want to use a plugin, just add the following lines to your function.php

    function disable_floc($headers) {
        $headers['Permissions-Policy'] = 'interest-cohort=()';
        return $headers;
      }
    
    add_filter('wp_headers', 'disable_floc');
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Roy Tanck

    (@roytanck)

    Thank you for suggesting this. Unfortunately, the snippet you posted does not preserve any (non-FLoC-related) values the header may have. This could lead to issues on sites where the Permissions-Policy header is already in use to control other permissions.

    My plugin preserves those values if present, and then adds the “interest-cohort=()”.

    Also, functions.php gets overwritten when your theme is updated, so in general it’s not the best option to add your own code there.

    Thread Starter georg

    (@georgp)

    Right, thanks for the remarks.
    However, many WordPress Websites do not have a Permission-Policy header at all (and even no Security header), so overwrite might not apply.

    Plugin Author Roy Tanck

    (@roytanck)

    Fair enough. Still, the best way to add the code you suggested would be to roll your own little plugin. Basically, mine exists to save you the trouble :).

    It contains a slightly fancier version of the approach in the snippet, and does nothing else.

    Thread Starter georg

    (@georgp)

    Well, I put it in my nginx conf 🙂 Thank you for providing this plugin for everybody.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘do it without a plugin’ is closed to new replies.