WP Consent API and GetTerms
Skip to Navigation Skip to Content

What is WP Consent API?

WP Consent API – AKA WordPress Consent API – is a free WordPress plugin that enables your cookie banner to communicate the consent preferences of your users to integrated plugins. The banner records each visitor’s consent choices through the API, and integrated plugins check those choices before they set cookies or track user data.

It’s an API only, not a cookie banner. You still need a consent management platform (CMP) to collect visitor consent choices, and for it to work, plugin developers need to integrate their plugin with its shared set of consent methods, so their code asks before setting cookies. What it gives them is a single set of methods to read and register the current consent category, which is what lets your CMP and the rest of your plugins work together. More than 200,000 sites run it, it’s proposed for WordPress core, and with GetTerms, you can integrate your site with it in minutes.

This guide explains the problem WP Consent API solves, how it works, what its consent categories mean, and how to set up the integration with GetTerms. We’ll cover:

  1. What problem does WP Consent API solve?
  2. How does WP Consent API work?
  3. What are the WP Consent API consent categories?
  4. Does WP Consent API replace a cookie banner?
  5. Which plugins work with WP Consent API?
  6. How is WP Consent API different from Google Consent Mode?
  7. How do you integrate WP Consent API with GetTerms?

What problem does WP Consent API solve?

WP Consent API lets your cookie banner’s consent choices reach the WordPress plugins that set cookies, and gives plugin developers one standard integration that works across leading consent platforms.

The problem

If you’ve ever installed a cookie banner, only to find that a few cookies still appear in your browser when you click reject, it’s likely those cookies are being set by WordPress plugins. They slip past your cookie banner’s script blocking because script blocking catches cookie-setting code loaded from recognized external domains, e.g., a request to googletagmanager.com for your Google tag. The challenge is that a plugin sets its cookies first-party, from the same domain as your site, either server-side in PHP or through JavaScript shipped inside the plugin. To block them would mean blocking your own domain.

The solution

WP Consent API provides a record containing each user’s consent status (allow or deny) for each consent category (marketing, statistics, statistics-anonymous, functional, and preferences), derived from the consent preferences stored by your cookie banner. This way, an integrated plugin can read that record and behave accordingly.

How does WP Consent API work?

WP Consent API works by making two consent checks with your cookie banner.

  1. The consent type for the visitor’s region, which can be either opt-in or opt-out. Opt-in regionssuch as the EU start with all categories set to “deny”, while opt-out regions start with all categories set to “allow”.
  2. The visitor’s own consent choices for each consent category, stored via cookies, e.g., wp_consent_marketing. These can be “not set”, “allow”, or “deny”.

 

Each time a user lands on your site, or loads a new page, WP Consent API asks your cookie banner for the consent_type. If opt-in, WP Consent API will only set categories to “allow” if the user’s consent choices are “allow”. If opt-out, WP Consent API will set all categories to “allow” unless the user’s consent choices are set to “deny”, even if the user hasn’t provided consent choices.

Plugins can then read the user’s consent choices from the cookies set by WP Consent API, and set cookies based on the user’s preferences.

What are the WP Consent API consent categories?

The API sorts consent into five standard categories. When a visitor uses your banner’s granular consent controls, their choice for each purpose flows through to the matching category, and every integrated plugin sees the same answer.

WP Consent API category What it covers
functional Cookies or any other form of local storage used for the sole purpose of carrying out the transmission of a communication over an electronic communications network, or where the technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the user.
preferences Cookies or any other form of local storage that cannot be seen as statistics, statistics-anonymous, marketing or functional, and where the technical storage or access is necessary for the legitimate purpose of storing preferences.
statistics Cookies or any other form of local storage that are used exclusively for statistical purposes (Analytics Cookies).
statistics-anonymous Cookies or any other form of local storage that are used exclusively for anonymous statistical purposes (Anonymous Analytics Cookies), that are placed on a first party domain, and that do not allow identification of particular individuals.
marketing Cookies or any other form of local storage required to create user profiles to send advertising or to track the user on a website or across websites for similar marketing purposes.

Definitions from the official WP Consent API documentation.

Does WP Consent API replace a cookie banner?

No. The API just records user consent choices in a format that plugins can read. It includes no banner, shows visitors nothing, and blocks nothing. You need a CMP to collect visitor choices and record them with WP Consent API.

Which plugins work with WP Consent API?

WP Consent API is supported by many of the most widely used plugins that touch visitor data, such as Google Site Kit, WooCommerce, WP Statistics, Burst Statistics, AddToAny, and Pixel Manager for WooCommerce.

It’s also supported by major CMP providers, with the plugin page listing several Consent Management Providers, including GetTerms, Cookiebot, Iubenda, and Complianz.

How is WP Consent API different from Google Consent Mode?

WP Consent API and Google Consent Mode do a similar job, in that they both carry consent signals; the difference is where they send those signals. WP Consent API sends consent signals to your WordPress plugins via cookies. Google Consent Mode sends consent signals to Google tags via gtag.js or Google Tag Manager.

If you’re running a WordPress site, you’ll likely want to use both WP Consent API and Google Consent Mode.

How do you integrate WP Consent API with GetTerms?

If you run GetTerms on WordPress, all you need to do is install and activate the WP Consent API plugin from the WordPress plugin directory. Our banner works with the API out of the box.

Frequently asked questions

Is WP Consent API part of WordPress core?

Not yet. It began as a feature plugin proposed for WordPress core in 2020, and in December 2024 the WordPress core team opened a fresh push to adopt it. Adoption accelerated after the EU’s Digital Markets Act took effect in March 2024, and until core adoption lands, it stays a plugin you install yourself.

Do I need WP Consent API if I don’t run analytics or ads?

Usually, yes. If genuinely no plugin on your site sets a non-essential cookie, the API has nothing to coordinate and you can skip it. Few sites can say that: a store running WooCommerce, a stats plugin, or a share button already puts you in scope.

What is service-level consent?

A newer layer of the API, available in both PHP and JavaScript. Beyond the five categories, consent can be granted or denied for one named service, like Google Analytics, independently of its category. The API checks for an explicit service-level answer first and falls back to the category when there isn’t one, so a visitor can accept statistics cookies in general while denying one specific analytics service.

Does WP Consent API store proof of consent?

No. It carries the current consent state; it doesn’t keep records of who consented to what and when. Consent records are your CMP’s job. GetTerms keeps user consent logs as proof of compliance.