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
- What is the WP Consent API
- Why this integration matters
- How the integration works
- Category mapping
- Consent type synchronization
- Script blocking coordination
- Setting up the integration
- FAQ
- Conclusion
What is the WP Consent API
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:
- Registers as the active consent manager so the WP Consent API knows which plugin is handling consent.
- 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.
- Synchronizes consent choices whenever a visitor saves their preferences through the banner. WPConsent translates its own categories into the standard WP Consent API format.
- 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 category | WP Consent API category | Consent state |
|---|---|---|
| Essential | functional | Always allowed |
| Essential | preferences | Always allowed |
| Statistics | statistics | Based on visitor choice |
| Statistics | statistics-anonymous | Based on visitor choice |
| Marketing | marketing | Based on visitor choice |
A few things to note:
- Essential maps to both
functionalandpreferencesbecause 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
statisticsandstatistics-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
marketingwith 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.
Consent type synchronization
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
- Install and activate the WP Consent API plugin from the WordPress plugin repository.
- 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
Do I need to install the WP Consent API separately?
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.
Why aren’t other plugins recognizing my visitors’ consent?
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.
Is the WP Consent API required for WPConsent to work?
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.