WordPress maintenance or security needs? Reach out!
TLDWP

Plugin: wp-consent-api (Used by 53,035 domains)

WP Consent API

WP Consent API is a plugin that standardizes the communication of accepted consent categories between plugins. It requires a cookie banner plugin and, at least, one other plugin that supports the WP Consent API.

With this plugin, all supporting plugins can use the same set of methods to read and register the current consent category, allowing consent management plugins and other plugins to work together, improving compliance with privacy laws.

WARNING: the plugin itself will not handle consent. It will show you how many plugins you have without Consent API support and will improve compliance on your site by ensuring smooth communication between cookie banner plugins and plugins that set cookies or track user data.

What problem does this plugin solve?

Currently, it is possible for a consent management plugin to block third-party services like Facebook, Google Maps, Twitter, etc. But if a WordPress plugin places a PHP cookie, a consent management plugin cannot prevent this.

Secondly, some plugins integrate the tracking code on the clientside in javascript files that, when blocked, break the site.

Or, if such a plugin’s javascript is minified, causing the URL to be unrecognizable and won’t get detected by an automatic blocking script.

Lastly, the blocking approach requires a list of all types of URL’s that tracks data. A generic API where plugins adhere to can greatly
facilitate a webmaster in getting a site compliant.

Does usage of this API prevent third-party services from tracking user data?

Primary this API is aimed at compliant first-party cookies or tracking by WordPress plugins. If such a plugin triggers, for example, Facebook,
usage of this API will be of help. If a user embeds a Facebook iframe, a blocking tool is needed that initially disables the iframe and or scripts.

Third-party scripts have to blocked by blocking functionality in a consent management plugin. To do this in core would be to intrusive, and is also not applicable to all users: only users with visitors from opt-in regions such as the European Union require such a feature. Such a feature also has a risk of breaking things. Additionally, blocking these and showing a nice placeholder requires even more sophisticated code, all of which should in my opinion not be part of WordPress core, for the same reasons.

How does it work?

There are two indicators that together tell if consent is given for a specific consent category, e.g., “marketing”:
1) the region based consent_type, which
can be opt-in, opt-out, or other possible consent_types;
2) and the visitor’s choice: not set, allow, or deny.

The consent_type is a function that wraps a filter, “wp_get_consent_type”. If there’s no consent management plugin to set it, it will return false. This will cause all consent categories to return true, allowing cookies to be set on all categories.

If opt-in is set using this filter, a category will only return true if the value of the visitor’s choice is “allow”.

If the region based consent_type is opt-out, it will return true if the visitor’s choice is not set or is “allow”.

Clientside, a consent management plugin can dynamically manipulate the consent type and set several cookie categories.

A plugin can use a hook to listen for changes or check the value of a given category.

Categories and most other stuff can be extended with a filter.

Existing integrations

Categorized, and sorted alphabetically

Example plugin

  • Example plugin. The plugin basically consists of a shortcode, with a div that shows a tracking or not tracking message. No actual tracking is done 🙂

Consent Management Providers

Consent Requiring Plugins

Demo site

wpconsentapi.org
Below are the plugins used to set up the demo site:

javascript, consent management plugin

//set consent type
window.wp_consent_type = 'optin'

//dispatch event when consent type is defined. This is useful if the region is detected server side, so the consent type is defined later during the pageload
let event = new CustomEvent('wp_consent_type_defined');
document.dispatchEvent( event );


//consent management plugin sets cookie when consent category value changes
wp_set_consent('marketing', 'allow');

javascript, tracking plugin

//listen to consent change event
document.addEventListener("wp_listen_for_consent_change", function (e) {
  var changedConsentCategory = e.detail;
  for (var key in changedConsentCategory) {
    if (changedConsentCategory.hasOwnProperty(key)) {
      if (key === 'marketing' && changedConsentCategory[key] === 'allow') {
        console.log("just given consent, track user")
      }
    }
  }
});

//basic implementation of consent check:
if (wp_has_consent('marketing')){
  activateMarketing();
  console.log("set marketing stuff now!");
} else {
  console.log("No marketing stuff please!");
}

PHP

//declare compliance with consent level API
$plugin = plugin_basename( __FILE__ );
add_filter( "wp_consent_api_registered_{$plugin}", '__return_true' );

/**
* Example how a plugin can register cookies with the consent API
 * These cookies can then be shown on the front-end, to the user, with wp_get_cookie_info()
 */

function my_wordpress_register_cookies(){
    if ( function_exists( 'wp_add_cookie_info' ) ) {
        wp_add_cookie_info( 'AMP_token', 'AMP', 'marketing', __( 'Session' ), __( 'Store a unique User ID.' ) );
    }
}
add_action('plugins_loaded', 'my_wordpress_register_cookies');


if (wp_has_consent('marketing')){
//do marketing stuff
}

Service-level consent

In addition to category-based consent, the API supports service-level consent control. This allows consent management plugins to grant or deny consent for specific services (like ‘google-analytics’ or ‘facebook-pixel’) independently from their category. When checking service consent with wp_has_service_consent(), the API first checks if explicit consent exists for that service. If no explicit consent is set, it falls back to the consent status of the service’s category. This enables fine-grained control: a user might accept statistics cookies in general, but explicitly deny a specific analytics service.

Service consent can be checked and set both server-side (PHP) and client-side (JavaScript):

PHP:

//check if a specific service has consent
if ( wp_has_service_consent( 'google-analytics' ) ) {
    //activate google analytics
}

//check if a service is explicitly denied
if ( wp_is_service_denied( 'facebook-pixel' ) ) {
    //service was explicitly denied by user
}

//set service consent
wp_set_service_consent( 'google-analytics', true ); //grant consent
wp_set_service_consent( 'facebook-pixel', false ); //deny consent

//listen for service consent changes
add_action( 'wp_consent_service_changed', function( $service, $consented ) {
    error_log( "Service {$service} consent changed to: " . ( $consented ? 'granted' : 'denied' ) );
}, 10, 2 );

JavaScript:

//check service consent
if ( wp_has_service_consent( 'youtube' ) ) {
    //activate tracking
}

//check if explicitly denied
if ( wp_is_service_denied( 'facebook-pixel' ) ) {
    //service denied
}

//set service consent
wp_set_service_consent( 'youtube', true );

//listen for service consent changes
document.addEventListener( 'wp_consent_api_status_change_service', function( e ) {
    console.log( 'Service: ' + e.detail.service + ', consented: ' + e.detail.value );
});

Any code suggestions? We’re on GitHub as well!

DomainExposuresHeadersLast Checked
c*a*k*v*l*e*o*i*g.com D Aug 16, 2026
c*u*h*p*c*.cl C Aug 16, 2026
s*y*a*k*s*c*r*t*.com B Aug 16, 2026
s*n*a*b*r*a*a*d*i.com F Aug 16, 2026
c*a*k*v*l*e*i*n*s*.com D Aug 16, 2026
m*d*e*t*r*e*.ie F Aug 16, 2026
p*n*t*a*t.com F Aug 16, 2026
p*n*t*a.com F Aug 16, 2026
p*t*a*k*a*a.com (WP 7.0.4) F Aug 16, 2026
s*p*s*e*k*n*.com (WP 7.0.4) D Aug 16, 2026
g*n*x*e*l*h*a*e.com (WP 7.0.2) F Aug 16, 2026
c*f*a*d*o*t*u*o*s*.fr C Aug 16, 2026
c*a*k*o*d*k*.com (WP 7.0.4) F Aug 16, 2026
v*l*a*e*l*d*m*r*i*.it F Aug 16, 2026
i*z*r*y.com (WP 7.0.4) F Aug 16, 2026
m*x*c*s*c*a*.org F Aug 16, 2026
o*d*e*s*.tv (WP 7.0.2) F Aug 16, 2026
m*o*e*e*i*f*j.ca B Aug 16, 2026
i*z*r*y.fr (WP 7.0.4) F Aug 16, 2026
b*n*u*y*m.com F Aug 16, 2026
b*n*l*c*.com (WP 7.0.4) F Aug 16, 2026
t*e*a*l*t*r*p*t*r*.c*.uk (WP 7.0.4) F Aug 16, 2026
u*i*e*.com (WP 7.0.4) D Aug 16, 2026
f*n*o*e*a*e*.com (WP 7.0.4) F Aug 16, 2026
w*l*s*r*e*s.com F Aug 16, 2026
w*l*g*o*p.com F Aug 16, 2026
w*l*.com F Aug 16, 2026
n*u*a*t.net (WP 7.0.4) F Aug 16, 2026
w*l*v*r*e.com F Aug 16, 2026
s*p*i*p*m*i*g*i.com (WP 7.0.3) F Aug 16, 2026
s*p*e*a*r*.com F Aug 16, 2026
h*m*n*a*i*a*p*r*n*r*.org (WP 7.0.4) D Aug 16, 2026
s*n*o*-*e*.com F Aug 16, 2026
j*r*e*a*e*s.es F Aug 16, 2026
m*j*s*i*t*o*p*o*.com F Aug 16, 2026
i*l*s*o*r*n*a*s.com F Aug 16, 2026
i*l*s*o*s*e*t*.com F Aug 16, 2026
i*l*s*o*s*e*t*l*.com F Aug 16, 2026
m*d*n*s.com (WP 7.0.4) D Aug 16, 2026
m*d*n*w*n*.com (WP 7.0.4) F Aug 16, 2026
r*a*d*s*r*c*.ca (WP 7.0.4) D Aug 16, 2026
h*g*o*d*r*o*u*i*n*.com F Aug 16, 2026
i*l*s*o*i*t*p*l*s*u*i*.com A Aug 16, 2026
c*s*n*s*s*i*m*m*.com (WP 6.8.3) F Aug 16, 2026
g*n*u*m*t*o*s.com (WP 7.0.4) F Aug 16, 2026
m*l*d*i*r.fr (WP 7.0.4) F Aug 16, 2026
a*u*t*i*e*b*o*e*.com C Aug 16, 2026
a*u*t*i*e*r*k*r*a*k.com C Aug 16, 2026
a*u*t*i*e*r*k*r*.com C Aug 16, 2026
a*u*t*i*e*r*k*r.com C Aug 16, 2026
d*y*c*s*s*e*s.com D Aug 16, 2026
g*l*e*n*.c*m.br (WP 7.0) F Aug 16, 2026
s*n*k*a*s*l*k.com (WP 7.0.4) F Aug 16, 2026
m*s*l*s*e*l*s*c*a*i*n*.fr F Aug 16, 2026
r*c*.fr (WP 7.0.4) F Aug 16, 2026
m*j*a.com (WP 7.0.4) F Aug 16, 2026
j*r*i*-*v*n*s.ro F Aug 16, 2026
q*e*o*t.ro C Aug 16, 2026
c*v*n*l*e*o*d*r*.com (WP 7.0.4) F Aug 16, 2026
d*y*c*f*t.com (WP 7.0.4) F Aug 16, 2026
h*d*o*f*e*d*i*t*r*.org (WP 7.0.4) D Aug 16, 2026
l*g*m*t*e*.org F Aug 16, 2026
s*c*a*c*y*t*c*s*n*.com D Aug 16, 2026
s*p*o*o*.com F Aug 16, 2026
d*y*c*a*k*n*a*.com D Aug 16, 2026
m*j*v*e*e*g*i*h*c*d*m*.com (WP 7.0.4) F Aug 16, 2026
s*u*i*s.com (WP 7.0.4) F Aug 16, 2026
m*j*o*t*a*s*e*.com (WP 6.9.7) F Aug 16, 2026
u*i*i*-*n*e*n*t*o*a*.com F Aug 16, 2026
u*i*i*a*r*m*g*z*n*.com (WP 7.0.4) C Aug 16, 2026
s*p*a*t*e*.com (WP 7.0.4) F Aug 16, 2026
h*n*a*l*s.de D Aug 16, 2026
c*t*o*i*m*s*e*.org (WP 6.9.4) F Aug 16, 2026
s*n*i*o*t*a*e*i*a.com F Aug 16, 2026
m*t*.gr (WP 7.0.4) F Aug 16, 2026
e*r*d*g*t*l.clinic (WP 7.0.4) F Aug 16, 2026
c*t*e*t*n*.com (WP 7.0.4) F Aug 16, 2026
a*u*t*c*s*a*i*g*e*s*n*.com (WP 7.0.4) F Aug 16, 2026
u*i*a*a*a*i*n.com (WP 7.0.4) F Aug 16, 2026
u*i*a*e*f.com (WP 7.0.4) F Aug 16, 2026
w*l*u*c*e*k*l*o*s.com F Aug 16, 2026
s*o*m*v*e*.com (WP 7.0.4) C Aug 16, 2026
n*i*.org D Aug 16, 2026
w*l*o*k.com (WP 7.0.4) F Aug 16, 2026
p*n*c*s*o*.com F Aug 16, 2026
p*n*c*a*b*e*t*.com F Aug 16, 2026
u*i*-*n*-*a*.com (WP 6.9.4) F Aug 16, 2026
m*r*m*s*.c*m.br D Aug 16, 2026
o*i*i*.c*m.br D Aug 16, 2026
m*d*m*-*l*m*u*.com (WP 7.0.4) F Aug 16, 2026
p*n*t*x*i*e.com (WP 6.9.7) F Aug 16, 2026
c*t*s*o*i*t*s.com F Aug 16, 2026
n*m*t*c.fr (WP 6.9.7) F Aug 16, 2026
r*b*l*a*k*t*n*.at (WP 7.0.4) F Aug 16, 2026
g*a*h*l*g*e.cc F Aug 16, 2026
g*a*h*l*g*s*h*-*n*l*s*.de F Aug 16, 2026
f*n*h*r*.com (WP 7.0.4) D Aug 16, 2026
b*n*n*j*e*o*r*.com (WP 7.0.4) F Aug 16, 2026
s*i*a*a*e*o.com (WP 7.0.4) D Aug 16, 2026
i*l*m*n*t*w*t*k*l*y.com (WP 6.8.8) F Aug 16, 2026

Top 50 Plugins

Plugin Count
elementor 1,765,990
contact-form-7 1,746,865
elementor-pro 1,050,425
woocommerce 815,055
revslider 606,334
jetpack 453,079
js_composer 417,970
wp-rocket 340,810
essential-addons-for-elementor-lite 263,681
gravityforms 256,290
complianz-gdpr 255,863
google-site-kit 233,632
cookie-law-info 227,514
instagram-feed 223,445
sitepress-multilingual-cms 209,789
header-footer-elementor 205,694
google-analytics-for-wordpress 204,211
bluehost-wordpress-plugin 192,250
elementskit-lite 179,354
gutenberg 167,821
cookie-notice 147,881
litespeed-cache 145,665
gtranslate 123,858
wpforms-lite 122,804
the-events-calendar 121,775
astra-sites 112,368
gutenberg-core 109,634
popup-maker 109,011
woocommerce-payments 108,807
tablepress 102,049
honeypot 97,728
astra-addon 93,430
wp-smushit 90,324
duracelltomi-google-tag-manager 90,220
layerslider 88,667
all-in-one-seo-pack 88,518
coblocks 88,370
bb-plugin 86,370
akismet 84,568
premium-addons-for-elementor 83,778
ml-slider 82,445
cleantalk-spam-protect 82,067
mailchimp-for-wp 81,136
megamenu 80,024
woocommerce-gateway-stripe 79,045
jet-engine 77,863
ewww-image-optimizer 76,849
fusion-builder 76,691
wp-pagenavi 76,436
smart-slider-3 75,648

Top 50 Themes

Theme Count
hello-elementor 619,569
Divi 493,328
astra 412,243
flatsome 141,666
Avada 120,404
generatepress 114,577
oceanwp 79,977
kadence 78,278
pub 76,729
enfold 68,301
salient 64,744
twentyseventeen 54,171
bb-theme 53,043
twentytwentyfour 52,635
betheme 52,394
blocksy 50,767
cocoon-master 49,236
twentytwentyfive 45,416
dt-the7 45,341
woodmart 44,219
h4 38,214
neve 37,911
Avada-Child-Theme 36,858
gox 36,333
bridge 31,107
twentytwentyone 30,150
lightning 30,075
twentytwenty 28,649
swell 28,189
bricks 26,556
Impreza 25,957
Newspaper 24,179
twentytwentythree 22,023
epik-redesign 19,089
twentytwentytwo 18,718
uncode 18,380
twentysixteen 17,596
pro 17,578
storefront 16,265
sydney 16,166
Total 14,281
hello-theme-child-master 14,031
factory-templates-4 13,700
themify-ultra 12,926
hestia 12,520
yootheme 12,444
extendable 12,436
yith-wonder 12,028
porto 11,917
twentyfifteen 11,878