Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Block FLoC in WordPress
// Disable FLoC
function disable_floc($headers) {
$headers['Permissions-Policy'] = 'interest-cohort=()';
return $headers;
add_filter('wp_headers', 'disable_floc');

This comment has been minimized.

Copy link
Owner Author

@henshaw henshaw commented Apr 18, 2021

From Opting your Website out of Google's FLoC Network

WordPress allows headers to be set from within its codebase via hooks. Add the code at the end of your active theme’s functions.php file.

Save the file in the WordPress admin backend and all new requests will contain the necessary header.

If you’re using any caching mechanisms or plugins (such as NGINX’s FastCGI Cache, W3 Total Cache, etc.) you’ll also need to clear the cache so that it be re-populated with the above addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment