WP Consent API Integration
ConsentMagic collects your visitors’ consent choices and forwards them to the WP Consent API plugin. Any WordPress plugin that integrates with WP Consent API can then read those choices and adjust its own behaviour — without you wiring anything up per plugin.
What WP Consent API is
The WP Consent API is an open standard for consent data in WordPress. It’s a shared hub other plugins can read from, so consent collection isn’t fragmented across every cookie banner, form, and analytics tool on your site.
What it does:
- Stores the visitor’s category-level consent choices.
- Lets other plugins query those choices.
What it doesn’t do:
- No banner or popup.
- No consent collection on its own.
- No script blocking.
It’s a pipe, not a UI. Something else — in this case ConsentMagic — does the asking and writing.
What ConsentMagic does
- Shows the consent banner or popup.
- Asks for category-based consent (Necessary, Functional, Analytics, Marketing).
- Blocks known tracking scripts directly (Meta Pixel, Google Ads, GA4, TikTok, and others) based on the visitor’s choices.
- Writes those choices to WP Consent API so other plugins can read them.
When you need this integration
ConsentMagic already blocks the major tracking scripts on its own. The WP Consent API integration matters when other plugins on your site need to know the visitor’s consent state — for example:
- Form plugins that decide whether to log IP addresses.
- E-commerce plugins that gate marketing cookies.
- Forum or membership plugins that store optional user data.
- Any plugin you’ve installed that supports WP Consent API.
If your site is only running PYS + ConsentMagic and nothing else needs consent data, the integration is optional. ConsentMagic’s own script blocking is enough.
Setup
- Install and activate the WP Consent API plugin. Get it from the WordPress plugin directory.
- Make sure ConsentMagic is active and configured. Banner is set up, categories defined, default rule chosen. See Main Options and Categories.
- That’s it. ConsentMagic detects WP Consent API automatically and starts writing consent choices to it as soon as a visitor interacts with the banner.
No extra ConsentMagic setting needs to be turned on.
Verify it’s working
- Open your site in an incognito window.
- Accept or decline categories in the ConsentMagic banner.
- Open DevTools → Application → Cookies for your domain. Look for a cookie named
wp_consent(or similar). Its value reflects the categories you accepted. - As an additional check, install a WP Consent API-compatible plugin and confirm it reads the consent state correctly.
What each side controls
| Job | ConsentMagic | WP Consent API |
|---|---|---|
| Show the consent banner | Yes | No |
| Collect choices | Yes | No |
| Block tracking scripts | Yes (Meta, Google, TikTok, and more) | No |
| Store consent for other plugins to read | Writes to it | Stores it |
| Provide a programmatic interface for plugins | No | Yes |
ConsentMagic is the front end. WP Consent API is the data layer other plugins talk to.