WPConsent Documentation

Documentation, Reference Materials, and Tutorials for WPConsent

WP Consent API Integration

Want other WordPress plugins to automatically recognize your visitors’ consent choices? WPConsent integrates with the WP Consent API plugin so that consent decisions made through your banner are shared with every compatible plugin on your site. This guide explains what the WP Consent API is, why the integration matters, and how WPConsent maps its categories to the standard API format.

Table of contents

The WP Consent API is a free WordPress plugin that creates a common language for consent management. Instead of every plugin building its own consent checks, the WP Consent API provides a single standard that plugins can use to ask “does this visitor allow statistics cookies?” or “does this visitor allow marketing cookies?”

Any plugin that supports the WP Consent API can read consent states from any compatible consent management plugin. This means you’re not locked into a specific ecosystem — your consent choices flow to every plugin that speaks the same language.

Why this integration matters

Without the WP Consent API, each plugin handles consent independently. This can lead to situations where:

  • A visitor accepts cookies through your WPConsent banner, but a form plugin doesn’t know about it and blocks functionality unnecessarily.
  • A visitor rejects marketing cookies, but an analytics plugin loads anyway because it doesn’t check WPConsent’s consent state.
  • You need to manually configure consent checks in multiple plugins instead of managing everything from one place.

With the integration active, WPConsent becomes the single source of truth for consent on your site. Every WP Consent API-compatible plugin automatically respects the choices visitors make through your banner.

How the integration works

When both WPConsent and the WP Consent API plugin are active, the integration happens automatically. There’s nothing to configure.

Here’s what WPConsent does behind the scenes:

  1. Registers as the active consent manager so the WP Consent API knows which plugin is handling consent.
  2. Sets the consent type (opt-in or opt-out) based on your WPConsent settings, so other plugins know whether to block or allow by default.
  3. Synchronizes consent choices whenever a visitor saves their preferences through the banner. WPConsent translates its own categories into the standard WP Consent API format.
  4. Avoids double-blocking by skipping its own script blocking for scripts that the WP Consent API already manages.

If the WP Consent API plugin isn’t installed, WPConsent works exactly the same — the integration simply doesn’t activate.

Category mapping

WPConsent uses its own category names (Essential, Statistics, Marketing), while the WP Consent API uses a different set of standard categories. WPConsent automatically maps between the two whenever a visitor saves their preferences.

WPConsent categoryWP Consent API categoryConsent state
EssentialfunctionalAlways allowed
EssentialpreferencesAlways allowed
StatisticsstatisticsBased on visitor choice
Statisticsstatistics-anonymousBased on visitor choice
MarketingmarketingBased on visitor choice

A few things to note:

  • Essential maps to both functional and preferences because WPConsent doesn’t have a separate Preferences category. Both are always set to “allowed” since essential cookies are required for your site to work.
  • Statistics maps to both statistics and statistics-anonymous. The WP Consent API distinguishes between regular and anonymous analytics, but WPConsent treats them the same — both follow the visitor’s Statistics choice.
  • Marketing maps directly to marketing with no additional translations.

This mapping means that any plugin checking wp_has_consent( 'statistics' ) or wp_has_consent( 'marketing' ) automatically respects the choices visitors make through your WPConsent banner.

WPConsent tells the WP Consent API whether your site uses opt-in or opt-out consent:

  • Opt-in (Default Allow off): Scripts and cookies are blocked until the visitor explicitly accepts. This is the standard for GDPR compliance.
  • Opt-out (Default Allow on): Scripts and cookies are allowed by default until the visitor actively rejects.

This setting is read from your WPConsent configuration under WPConsent >> Settings (the Default Allow toggle). Other plugins that check the consent type can then adjust their behavior accordingly.

Script blocking coordination

When both WPConsent and the WP Consent API manage the same script, double-blocking can occur. To prevent this, WPConsent automatically skips its own blocking for scripts that the WP Consent API already handles.

For example, WooCommerce’s attribution tracking script is managed through the WP Consent API. WPConsent detects this and lets WP Consent API handle the blocking instead of applying its own rules on top.

Setting up the integration

  1. Install and activate the WP Consent API plugin from the WordPress plugin repository.
  2. That’s it. WPConsent detects the WP Consent API automatically and activates the integration.

There are no additional settings to configure. The category mapping, consent type synchronization, and script blocking coordination all happen automatically.

FAQ

Yes. The WP Consent API is a separate free plugin available from the WordPress plugin repository. Install and activate it alongside WPConsent to enable the integration.

First, verify that the WP Consent API plugin is installed and active. Then confirm that the other plugin actually supports the WP Consent API (check its documentation). Finally, try testing in an incognito window to rule out cached consent state.

No. WPConsent works fully on its own. The WP Consent API integration is an optional addition that improves interoperability with other plugins that support the standard.

Does the integration require configuration?

No. Once both plugins are active, WPConsent handles everything automatically — registration, category mapping, consent type synchronization, and script blocking coordination.

Conclusion

The WP Consent API integration lets WPConsent share consent decisions with every compatible plugin on your site through a standardized interface. Install the WP Consent API plugin, and WPConsent handles the rest automatically. For more on related topics, see managing cookie categories and automatic script blocking.

Was this article helpful?

Related Articles