TL;DR:
WordPress has no built-in way to stop third party cookies loading before a visitor agrees. WPConsent scans your site, finds the scripts that set them, and blocks each one until consent is given. Setup runs through a wizard and takes a few minutes, with no code involved.
If you’re running a WordPress website, then understanding and controlling cookies is a necessity, especially with growing privacy regulations like GDPR and CCPA.
Cookies are like tiny digital crumbs that websites leave on your web browser.
While some cookies are beneficial, others raise privacy concerns. That’s because you’ll need to get permission from your visitors before using certain types of cookies.
Sadly, WordPress doesn’t come with a built-in cookie management system.
But with the right plugin, like WPConsent, you can easily set up cookie consent without touching a single line of code and block third-party cookies.
In this article, I will show you how to block cookies on your WordPress website using a very simple method.
Key Takeaways
- Essential cookies are exempt from consent rules. Non-essential ones, which covers statistics and marketing, need permission before they load.
- GDPR, CCPA, LGPD and PIPEDA all require consent before non-essential cookies are set, and fines follow non-compliance.
- WPConsent’s scanner detects third party scripts automatically, including Google Analytics, Google Ads, Facebook Pixel, LinkedIn Insight, TikTok and Snapchat.
- Ticking ‘Prevent known scripts from adding cookies before consent is given’ and running Auto-Configure is what actually does the blocking.
- Blocking scripts is only half of it. You still need a consent banner so visitors can grant or refuse permission.
Want to see how much you know about blocking third-party cookies first? Skip to this quiz ↓.
Navigate this article with the table of contents below.
- Understanding Different Types of Cookies
- Does WordPress Use Cookies by Default?
- Can You Disable Cookies in WordPress?
- Why Block Third-Party Cookies in WordPress
- Block Third-Party Cookies on Your WordPress Site
- Add a Cookie Consent Banner in WordPress
- Blocking Third Party Cookies: Test Your Knowledge
- Ready to Block Third-Party Cookies on WordPress?
Understanding Different Types of Cookies
Cookies are small text files that websites put on your web browsers when you visit them. Think of them as little digital labels that help websites remember things about you, like login details, preferences, and more.
While there are many types of cookies, they can be generally categorized into two main types:
- Essential Cookies: These cookies are vital for the basic operation of a website. They enable core functionalities like user login, session management, and eCommerce shopping carts. Without these cookies, a website may not function correctly. Generally, these are exempt from strict consent requirements by privacy laws.
- Non-essential Cookies: These cookies, while not strictly necessary for the website to function, serve various other purposes. They can be further broken down into the following categories:
- Statistics Cookies: Used to track website traffic, user behavior, and engagement. Tools like Google Analytics rely on these cookies to provide website owners with valuable insights.
- Marketing Cookies: These cookies track users across websites to deliver personalized advertisements and measure the performance of marketing campaigns.
Now that you understand the basics about cookies, let’s see why is it important to block them in WordPress.
Does WordPress Use Cookies by Default?
Yes. A standard WordPress install sets several cookies before you add a single plugin, and they are not optional.
wordpress_test_cookiechecks whether the browser accepts cookies at all.wordpress_logged_in_[hash]keeps you signed in and identifies who you are.wordpress_sec_[hash]protects admin pages when SSL is in use.wp-settings-[user id]remembers your admin screen preferences for a year.comment_author_[hash]saves a commenter’s name, email and site so they do not retype them.
Nearly all of these are essential. They run logins, sessions and admin screens, so privacy laws generally exempt them and you do not need consent to set them.
The comment cookies are the grey area. They are a convenience rather than a necessity, which is why most consent plugins list them separately.
Your theme and plugins add more on top, and that is where the cookies needing consent come from. A scan is the only reliable way to see what your site actually sets, so start by finding which cookies your WordPress site is using.
Can You Disable Cookies in WordPress?
Not completely, and you would not want to.
WordPress needs cookies to function. Switch off the login cookies, and nobody reaches the dashboard. Remove WooCommerce session cookies and carts empty themselves between pages. The essential set is load-bearing.
What people usually mean by disabling cookies is narrower than that: stop the tracking.
Analytics, advertising pixels, embedded videos, and social widgets all set cookies that have nothing to do with running your site, and those are the ones you can remove or gate behind consent.
There are three ways to handle them:
- Remove the source. Delete the Analytics tag, the pixel or the embed and its cookies go with it. Effective, but you lose the feature.
- Block until consent. Keep the script, and stop it running until the visitor agrees. That is what the rest of this guide covers.
- Do nothing and disclose. Legal in a shrinking number of places, and increasingly expensive where it is not. California site owners are already receiving CIPA demand letters over exactly this.
Blocking is the middle path, and for most sites it is the right one. You keep your analytics and your embeds, and they simply wait for permission. Which rules apply depends on where your visitors are, and GDPR and CCPA differ on the detail.
Why Block Third-Party Cookies in WordPress
There are multiple reasons for blocking or controlling cookies on your WordPress website. But one of the main reasons for blocking cookies in WordPress is because of privacy regulations worldwide. They require websites to obtain user consent before setting non-essential cookies.
For example, General Data Protection Regulation (GDPR) in the European Union requires websites to obtain explicit consent before processing personal data, including the use of non-essential cookies.
Similarly, California Consumer Privacy Act (CCPA) in California gives consumers rights regarding their personal information. This includes the right to know what data is collected and to opt-out of the sale of their personal information, which can be relevant to certain cookie uses.
Other regulations like LGPD (Brazil), PIPEDA (Canada), and various state laws in the US are also shaping the landscape of cookie consent and privacy. Non-compliance with these regulations can result in significant fines and legal actions against your website.
Besides that, transparency and providing users control over cookies are essential for building trust. When users understand how their data is being used and feel they have control, they are more likely to have a positive experience on your website.
That said, let’s see how you can easily block cookies on your WordPress website.
Block Third-Party Cookies on Your WordPress Site
The easiest way to block third party cookies in WordPress is by using WPConsent.
It is the best WordPress consent management plugin, and it includes a powerful automatic script blocking feature that helps protect your visitors’ privacy by controlling when and how third-party cookies load on your website.
WPConsent automatically detects scripts from popular services like Google Analytics, Matomo, Google Ads, Facebook Pixel, LinkedIn Insight, Snapchat pixel, TikTok pixel, and more.
Other than that, it also offers pre-built cookie consent banner templates and lots of customization options. Plus, you can see consent logs and easily manage them from your WordPress dashboard.
For this tutorial, I’ll use the WPConsent Pro version because it automatically configures cookie data from other plugins like WooCommerce and WPForms.
The Pro version also helps see consent records and offers a modal cookie banner template. There is also a WPConsent Lite version that you can use for free and block common 3rd party scripts and core features.
Compare WPConsent Pro vs Free here.
First, you’ll need to install and activate the WPConsent plugin on your website. If you need help, then please see this guide on how to install a WordPress plugin.
Once the plugin active, you will see the WPConsent setup wizard. Go ahead and click the ‘Let’s Get Started’ button and follow the onscreen instructions.

On the next screen, you’ll need to enter the license key and click the ‘Verify Key’ button. You can find the key in the WPConsent account area.
After that, simply click the ‘Scan Your Website’ button.

WPConsent will now perform a scan of your site and detect third-party scripts.
When the scan is complete, you’ll see a popup message. Go ahead and click the ‘OK’ button.

After that, WPConsent show the third-party services that may be using cookies on your site.
You can simply select the service, check the ‘Prevent known scripts from adding cookies before consent is given’ option, and click the ‘Auto-Configure Selected’ button.
This way, the selected scripts will be stopped from adding cookies before a user gives consent.

On the next screen, WPConsent will show you different cookie banner templates.
You can simply scroll down and click the ‘Save & Complete Setup’ button to exit the setup wizard.

Alternatively, you can also head to WPConsent » Scanner from the WordPress dashboard to block third party scripts from adding cookies without consent.
After that, simply click the ‘Scan Your Website’ button.

Next, you can scroll down to see the detailed report and view which services use cookies on your site.
From here, ensure that the ‘Prevent known scripts from adding cookies before consent is given’ option is checked and then click the ‘Automatically Configure Cookies’ button.

A popup window will now open confirming to automatically configure cookies on your site.
Go ahead and click the ‘Yes’ button to continue.

Once WPConsent populates cookie data from the selected services, you’ll see a success message.
You can click the ‘Ok’ button to close the message.

Next, if you want to see the cookie data, then you can head to WPConsent » Settings from the admin panel.
From here, simply switch to the ‘Cookies’ tab. Here, you’ll see details of all the cookies along with their name, ID, description, and duration.
WPConsent also lets you edit the details of each cookie and delete them.

Add a Cookie Consent Banner in WordPress
After preventing third party scripts from adding cookies without consent on your site, the next step is to show a cookie banner on your site.
This allows your website visitors to give consent whether they’d want third party cookies to be added to their browser.
It also ensures that you’re complying with different data privacy laws while building trust with your audience.
With WPConsent, you get pre-built banner templates with real-time preview. You can simply select a layout, choose its position, and customize the style and content according to your requirements.

If you need help, then please see our detailed guide on how to add a cookie consent banner to your WordPress website.
For example, here’s how the banner looks like on our website.

That’s it! You’ve successfully created a cookie consent banner to block third party cookies in WordPress.
Blocking Third Party Cookies: Test Your Knowledge
Three questions, pulled straight from the sections above. Pick an answer to see how you did.
Correct.Not Quite. The right answer is B.
Without them a site cannot work properly, so privacy laws generally exempt them. Statistics and marketing cookies are both non-essential and both need consent first. If that split is still fuzzy, start with what tracking cookies actually are.
Correct.Not Quite. The right answer is C.
The scan only finds the scripts and lists the services using them. Nothing is blocked until you tick that option and auto-configure the selected services. To see the cookies themselves first, try finding which cookies your site is using.
Correct.Not Quite. The right answer is A.
Blocking is only half the job. With no banner there is no way for anyone to say yes, so the scripts stay blocked forever and you hold no record of consent. When you are ready to check the whole setup, run a cookie compliance audit.
Quiz complete.
Started with the quiz and ready to read the article? Jump back to the start of the guide.
WPConsent
Block third party cookies without writing a line of code
Automatic script blocking, a consent banner, and consent records in one plugin.
Ready to Block Third-Party Cookies on WordPress?
Give WPConsent a try today and make your site compliant with privacy laws.
Plus, you also get automatic script blocking and a compressive cookie management solution.
If you liked this article, then please follow us on X (formerly known as Twitter). You can also leave a comment below if you need any assistance.
