Skip to content

Works with your stack

Cookie consent that speaks WP Consent API

refreshed on every page

← Cookie Rocks for your stack

WP Consent API is a free plugin that carries the visitor’s choice from your consent banner to other plugins, such as Site Kit, WooCommerce and WP Statistics. It asks nothing and holds nothing on its own. Cookie Rocks gives it the choice on every page, not only at the click.

WordPress.org

WP Consent API

WordPress plugin

Tested
Tested version
2.1.0
How
Tested automatically at each Cookie Rocks release
Last test
3 November 2026
Latest version
2.1.0 tested
Active installs
300,000+

What WP Consent API puts on your pages

A small script
Loaded at the bottom of each page, from your own site. It makes no request to another site and adds no tracker.
One cookie per category
Its wp_consent_ cookies hold allow or deny for functional, preferences, statistics, statistics-anonymous and marketing. Only the consent plugin writes them.
A consent type
Opt-in or opt-out, set by the consent plugin. Other plugins read it to know whether they must wait for the visitor.

What matters for consent with WP Consent API

Alone, it allows everything

If no consent plugin sets the consent type, WP Consent API tells every plugin that consent is given. Installing it without a banner protects nothing.

Refreshed on every page

The API’s cookies expire on their own. A banner that writes them only at the click can let them run out first, and plugins then read a refusal from a visitor who accepted. Cookie Rocks writes the choice again on every page and gives those cookies the same lifetime as its own.

Declared, with the right type

Cookie Rocks registers itself with WP Consent API as a consent plugin. It sets the type to opt-in, or to opt-out when you use information mode where the law allows it.

Plugins with a list of their own

Some plugins trust only the consent plugins named in their own code. WP Statistics is one of them: with any other banner, its consent setting stays greyed out. With WP Consent API active, the complete plugin makes WP Statistics wait for the choice anyway, without changing its settings.

Keep its script whole

WP Consent API’s script relies on a small inline variable printed just before it. A performance plugin that combines or delays it breaks the API. Exclude it from both.

Cookie Rocks with WP Consent API

  • Passes the visitor’s choice to WP Consent API on every page, where this plugin reads it.
  • Registers with WP Consent API, with cookie lifetimes matched to the visitor’s choice.

All the features

What our tests found on WP Consent API

  • Good to know · WP Consent APIWith WP Consent API, comment cookies wait for preferences consent

    With WP Consent API active, WordPress no longer shows the comment form's "save my name" checkbox, and the comment_author_* cookies are set only when the preferences category is granted.

    Read in its code, 16 October 2026, WP Consent API 2.1.0.

  • Good to know · WP Consent APIWP Consent API stores the choice in one cookie per category

    setting “wp_consent_api_cookie_expiration (filter)” · by default: 30 days

    • Five wp_consent_ cookies, plus wp_consent_consented_services for single tools.
    • Set by JavaScript for 30 days, only when a consent plugin writes the choice.
    • Read by PHP from the request, so a page served from cache ignores them.

    Read in its code, 16 October 2026, WP Consent API 2.1.0.

    Full detail

    WP Consent API stores the choice in one first-party cookie per category (wp_consent_functional, wp_consent_preferences, wp_consent_statistics, wp_consent_statistics-anonymous, wp_consent_marketing), set by JavaScript with path=/, Secure on HTTPS and no SameSite, for 30 days unless filters change it, plus wp_consent_consented_services (JSON) for consent to single tools. They are written only when a consent plugin calls wp_set_consent(). Its change event fires only when a value changes. PHP reads come from the request cookies, so a page served from cache ignores them. The service hook in code is wp_consent_api_status_change_service.

  • Good to know · WP Consent APIWithout a consent plugin, WP Consent API says yes to every category

    It asks for nothing and blocks nothing. With optin, consent is true only when the category cookie is allow; with optout, while the cookie does not exist. It contacts no other site.

    Read in its code, 16 October 2026, WP Consent API 2.1.0.

    Full detail

    WP Consent API asks for nothing and blocks nothing. Without a consent plugin that sets the consent type, wp_has_consent() returns true for every category. With optin it is true only when the category cookie is allow; with optout it is true while the cookie does not exist. Categories are functional, preferences, statistics, statistics-anonymous and marketing (no necessary). Its script loads in the footer at priority PHP_INT_MAX - 100 and relies on an inline consent_api variable printed just before it. It makes no request to another site and contains no gtag or Consent Mode code.

How we test it

At every Cookie Rocks release

It runs in the automatic tests of every Cookie Rocks release, next to the banner.

  • WP Consent API 2.1.0, tested on 3 November 2026.

Questions

Do I need WP Consent API?

Only if a plugin on your site reads the choice through it, such as Site Kit, WooCommerce or WP Statistics. The free Audit tells you which case you are in: Connected, Missing or Not needed yet.

Does it replace a consent banner?

No. It shows nothing and holds nothing. It only carries the choice made in your banner to the plugins that ask for it.

Which categories does Cookie Rocks send?

The five of the API. Functional follows Necessary, preferences and marketing follow their own categories, statistics follows Statistics. Statistics-anonymous follows audience measurement when your site uses that exemption, and Statistics otherwise.

What changes for comments?

With WP Consent API active, WordPress sets its comment cookies only when the visitor accepts preferences, and the comment form no longer shows its own cookie checkbox.

What happens after the 30-day trial?

The banner, your visitors’ choices and your proofs of consent keep working. Without a key, most settings lock, updates and support stop. Take a key at any time and everything opens again.

For sites using WP Consent API

Every plugin reads the same choice.

refreshed on every page

Every feature of the complete plugin for 30 days, no card. WP Consent API stays installed and keeps its job.

  • During the trial: everything, including the full settings and the scans
  • After 30 days without a key: the banner, your visitors’ choices and your proofs of consent keep working
  • What waits for a key: most settings, updates and support

How the trial works, in detail

Get your trial key

Your e-mail and your site. Your key arrives as soon as you confirm your e-mail.

One trial per domain. Local and staging sites never use up your key.

We keep your e-mail address to send your key and help you with it, as explained in our privacy policy. No newsletter, nothing else.