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 $typeOrId[, 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;

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

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

        
On this page

Search results