Documentation

consent.php

Table of Contents

Functions

wp_rcb_consent_given()  : mixed
Check if a given technical information (e.g. HTTP Cookie, LocalStorage, ...) has a consent:

Functions

Check if a given technical information (e.g. HTTP Cookie, LocalStorage, ...) has a consent:

wp_rcb_consent_given(string|int $typeOrIdOrUniqueName[, string $name = null ][, string $host = null ]) : mixed
  • When a technical information exists in defined cookies, the Promise is only resolved after given consent
  • When no technical information exists, the Promise is immediate resolved
$consent = function_exists('wp_rcb_consent_given') ? wp_rcb_consent_given("http", "_twitter_sess", ".twitter.com") : true;

You can also check for consent by cookie ID (ID in wp_posts, post id):

$consent = function_exists('wp_rcb_consent_given') ? wp_rcb_consent_given(15) : true;

Since 5.0.4: You can also check for consent by service unique name:

$consent = function_exists('wp_rcb_consent_given') ? wp_rcb_consent_given("google-analytics-ua") : true;

Attention: Do not use this function if you can get the conditional consent into your frontend coding and use instead the window.consentApi!

Parameters
$typeOrIdOrUniqueName : string|int
$name : string = null
$host : string = null
Tags
since
2.11.1

        
On this page

Search results