Website Guider

The Ultimate Resource for WPadmins and Geeks

How To Disable Google’s FLoC in WordPress

Many of you may be aware of the latest announcement by Google related to tracking users for ads purposes. Various parties haven’t accepted this new kind of tracking system like DuckDuckGo, Brave, etc.

Google will start tracking users with the help of machine learning. They won’t use third-party cookies to track users but through a new and modern way called FLoC(Federated Learning of Cohorts).

Let me tell what this means.

What Does FloC mean and How It Impacts Users?

As already stated, it is a new tracking method for tracking users on the internet. It is an alternative to third-party cookies and is completely based on machine learning.

FLoC will study users anonymously and group them in ‘cohorts’ so they can serve ads based on cohorts.

By introducing this system, Google won’t stop tracking you, but it will study you without the help of third-party cookies and more worrying ‘anonymously.’

Different companies have raised questions like DuckDuckGo, Brave, etc.

If you are among the men who aren’t viewing this change positively, you can easily block this feature by doing few tweaks.

Lets see how we can disable Google’s FLoC in WordPress.

How To Disable/Block FLoC In WordPress?

The basic way to avoid being tracked on this new system is to not use Chrome and use privacy focused browser.

Also, the website owners can also keep their web servers out of this by opting out from it. It can be done in many ways.

Lets see how it can be done.

Adding Header in functions.php file

The first and easiest way to avoid participating in FLoC is to add the Header. You can copy the below code and add it to the end of the functions.php file.

add_filter( 'wp_headers', 'wg_disable_floc' );
function wg_disable_floc( $headers ) {
    if ( empty( $headers['Permissions-Policy'] ) ) {
	$headers['Permissions-Policy'] = 'interest-cohort=()';
    } elseif ( ! empty( $headers['Permissions-Policy'] ) && false === strpos( $headers['Permissions-Policy'], 'interest-cohort' ) ) {
	$headers['Permissions-Policy'] .= ', interest-cohort=()';
    return $headers;

Once done, hit save and sit back.

Adding Header through .htaccess

Headers can be set also by Apache configuration file. You can add the following directive in .htaccess file.

<IfModule mod_headers.c>
  Header always set Permissions-Policy: interest-cohort=()

Adding Header Through NGINX Config File

If your website runs on NGINX web server, then you have to add this directive to config file.

server {
    location / {
      add_header Permissions-Policy interest-cohort=();

Remember, if you use only one config file for various websites, be sure to add the directive to each server block.


These were the easiest methods to disable FLoC in WordPress without a plugin. Now, it is your turn. What is your opinion regarding FLoC?

Please let me know in comments section. I hope you liked the tutorial, be sure to share the article with your mates.

Raashid Din Dar

Raashid Din Dar is a web developer and designer. He specialises in WordPress Theme and Plugin development. Also, Web Designing is what he loves.He loves to read books and play with friends.

One thought on “How To Disable Google’s FLoC in WordPress

  1. Since FLOC is basically a replacement for 3rd-party cookies, which I’ve despised as a user AND website owner, my opinion is pretty much a given. But from a user’s perspective, entries in headers is pretty much a “suggestion” kind of like that robots.txt file. To ENFORCE this NOT being used, time to switch to DuckDuckGo instead of Google, and if you MUST use a Chromium derivative (Chrome is just a spin-off of the latter), use Brave instead and you’ll have pretty much all the same features except for custom plugins.

    I only recently became aware of this as an issue with a fresh install of the JOOMLA blogging software. One of the messages waiting for me when I logged in as administrator is that Joomla automatically enables the FLOC-disabling header by default.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top