Skip to main content
Agency Program Hosting from 10% off. A dedicated account manager. Priority support. Built for growing agencies. Hosting from 10% off, a dedicated account manager and priority support for growing agencies. Speak to the team Join free
WP Consent API icon

WP Consent API

v2.1.0
by Rogier Lankhorst · 5.0 (2 reviews)

Simple Consent API to read and register the current consent category.

300K+ active installs Updated Dec 01, 2026 Tested to 7.2 Requires PHP 7.4
Try Demo Download
Pre-installed Ready in ~10s No card
WP Consent API

About WP Consent API

The WP Consent API plugin helps improve compliance with privacy laws by standardizing communication between cookie banner plugins and other plugins that set cookies or track user data. It allows all supporting plugins to use the same set of methods to read and register the current consent category. However, it is important to note that this plugin itself does not handle consent, it only facilitates communication between plugins.

Frequently asked questions

What problem does this plugin solve?
This plugin standardizes communication of accepted consent categories between plugins. It helps address issues where consent management plugins cannot prevent PHP cookies or block minified JavaScript tracking codes. It also provides a generic API for plugins to adhere to, facilitating site compliance.
Does usage of this API prevent third-party services from tracking user data?
This API primarily targets compliant first-party cookies or tracking by WordPress plugins. If a plugin triggers a service like Facebook, this API can help. For embedded third-party iframes, a blocking tool is still needed.
What does this plugin do?
WP Consent API standardizes how plugins communicate accepted consent categories. It allows consent management plugins and other plugins to work together using the same methods to read and register consent categories. This improves compliance with privacy laws.

Changelog

2.1.0

Change: internally unused wp_set_cookie() function dropped in favor of upcoming WordPress core wp_set_cookie() function.

2.0.1

Fix: typo in ‘preferences’ category, causing comment cookies functionality to follow functional category consent, props @sjinks

2.0.0

  • New: Service-level consent API – allows granular consent control per service in addition to category-based consent
  • New: wp_has_service_consent() function to check if a specific service has consent
  • New: wp_is_service_denied() function to check if a specific service is explicitly denied
  • New: wp_set_service_consent() function to set consent for a specific service
  • New: wp_consent_service_changed action hook fires when service consent changes
  • New: JavaScript functions wp_has_service_consent(), wp_is_service_denied(), and wp_set_service_consent()
  • New: JavaScript event wp_consent_api_status_change_service for service consent changes
  • Improvement: Added type hints throughout codebase for better code quality and IDE support
  • Improvement: Added init() method for cleaner plugin initialization
  • Security: escape logged notice in _doing_it_wrong function, props @mujuonly

1.0.8

  • Updated tested up to
  • Dropped loading of translations, and loading of plugin_data, to prevent translation loading notices by WordPress 6.7, props @mujuonly
  • Dropped obsolete function wp_has_cookie_info, props @szepeviktor

1.0.7

  • Tested up to

1.0.6

  • Tested up to

1.0.5

  • tested up to

1.0.4

  • Improvement: only fire on change event if an actual change was detected on the consent.

1.0.3

  • Fix: wp_has_consent function contained a condition which caused it to always return true on serverside optin consent checks.

1.0.2

  • Fix $collected_personal_data documentation, as $is_personal_data was deprecated (props @jazzsequence, https://github.com/rlankhorst/wp-consent-level-api/issues/54)
  • Fix the docblock so it reflects the actual value returned (props @jazzsequence, https://github.com/rlankhorst/wp-consent-level-api/issues/52)
  • Styling changes to site health
  • Code structure changes
  • Removed is_personal_data property, as it’s implicitly contained in the personaldata property
  • Made cookie prefix filterable props @jazzsequence

1.0.1

  • Cookiebot added as existing integration
  • Some small improvements to comply with WordPress coding styles

1.0.0

  • changed consent_api_setcookie into consent_api_set_cookie for naming consistency with the getcookie method
  • added prefix in javascript set and get methods, to be compatible with PHP cookies, props @phpgeek
  • removed duplicate statistics category, props @phpgeek

Try other plugins

Yoast SEO icon

Yoast SEO

4.8 · 10M+ installs

Improve your WordPress SEO: Write better content and have a fully optimized WordPress site using the Yoast SEO…

Classic Editor icon

Classic Editor

4.9 · 8M+ installs

Enables the previous "classic" editor and the old-style Edit Post screen with TinyMCE, Meta Boxes, etc. Supports all…

WooCommerce icon

WooCommerce

4.5 · 7M+ installs

Everything you need to launch an online store in days and keep it growing for years. From your…