Signocore Consent has one PHP filter, for the consent categories, and a small JavaScript API with events on window. Add PHP callbacks from a child theme's functions.php or a must-use plugin. For holding scripts back until consent, you need neither: see Load scripts after consent.
No hooks match "".
Consent categories
The filter runs on frontend pages while Cookie consent is on under Settings → Cookie consent, for the banner, the settings window and the Consent Mode output alike.
signocore_consent_categories
filterFilters the consent categories and the Consent Mode signals each one grants.
The categories appear in the settings window in the order of the array. Each one has a label and a description, both shown as plain text, required and signals. A required category shows Always active instead of a switch, is always stored as true, and its signals are granted in the Consent Mode defaults.
signals lists the Google Consent Mode signals the category grants: ad_storage, ad_user_data, ad_personalization, analytics_storage, functionality_storage, personalization_storage and security_storage. Other names are dropped. A category without signals only gates held-back scripts, and a signal that no category grants stays denied.
Every category is stored in the signocore_consent cookie and sent with the JavaScript events under its key. Use lowercase letters, numbers and underscores for keys. The keys v, ts and method are used by the cookie itself, so categories with those keys are dropped.
Visitors who made their choice before you added a category are not asked again. For them, the new category counts as not granted until they change their choice.
| Parameter | Type | Description |
|---|---|---|
$categories |
array |
The categories keyed by consent key: necessary, preferences, statistics and marketing by default. Each is an array with label (string), description (string), required (bool) and signals (list of strings). |
Returns array The categories, in the order to show them.
add_filter('signocore_consent_categories', function (array $categories): array { $categories['marketing']['label'] = 'Advertising'; // Gates the chat widget only, so it grants no Consent Mode signals. $categories['chat'] = [ 'label' => 'Live chat', 'description' => 'Lets you talk to our support team through the chat widget.', 'required' => false, 'signals' => [], ]; return $categories; });
JavaScript events
The consent script dispatches these events on window. It also exposes window.SignocoreConsent with get(), has(list) and open(), described in Check the choice in your own code.
The saved choice is a JSON object in the first-party cookie signocore_consent, and the same object is passed as event.detail where an event carries a choice:
{"v": 1, "ts": 1761292800, "necessary": true, "preferences": false, "statistics": true, "marketing": false, "method": "custom"}
signocore-consent:ready
eventFires once per page as soon as a choice exists.
Fires when the page loads for a returning visitor, otherwise when the visitor makes a choice on this page. It never fires twice on the same page, so it is the one event to wait for when your code needs the choice, whenever it was made. event.detail holds the choice.
| Parameter | Type | Description |
|---|---|---|
detail |
object |
The saved choice, with the same keys as signocore-consent:updated. |
window.addEventListener('signocore-consent:ready', (event) => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: 'consent_ready', consent_method: event.detail.method }); });
Fires when a visitor makes or changes a choice.
Fires after the cookie is saved, the Consent Mode update is sent and allowed scripts are started: on Accept all and Reject all, in the banner or the settings window, on Save choices, and when the settings window is closed before any choice was made. It does not fire on later page views. event.detail holds the same data as the cookie.
| Parameter | Type | Description |
|---|---|---|
detail.v |
number |
The format version, currently 1. |
detail.ts |
number |
When the choice was made, as a Unix timestamp in seconds. |
detail.necessary |
boolean |
Always true. |
detail.preferences |
boolean |
Consent for the Preferences category. |
detail.statistics |
boolean |
Consent for the Statistics category. |
detail.marketing |
boolean |
Consent for the Marketing category. |
detail.{key} |
boolean |
One value for each category added with signocore_consent_categories. Required categories are always true. |
detail.method |
string |
accept_all, reject_all, custom or dismiss. dismiss means the settings window was closed before any choice was made. |
window.addEventListener('signocore-consent:updated', (event) => { if (event.detail.statistics === false) { // The visitor withdrew consent: stop your own measurement. window.myAnalytics?.stop(); } });
Fires when the consent banner appears.
Fires once the page has loaded, for visitors without a saved choice. event.detail is an empty object.
window.addEventListener('signocore-consent:banner-shown', () => { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: 'consent_banner_shown' }); });
Fires when the settings window opens.
Fires when a visitor clicks Customize in the banner, the floating button or a cookie settings link, and when your code calls SignocoreConsent.open(). event.detail is an empty object.
// Mark the page while the window is open, for example to hide a chat bubble that would cover it. window.addEventListener('signocore-consent:preferences-opened', () => { document.body.classList.add('consent-window-open'); });
Fires when the settings window closes.
Fires on Save choices and Accept all in the window, on the close button, on a click on the backdrop and on the Escape key. It only fires when the window was open. When a choice is saved, signocore-consent:updated fires first. event.detail is an empty object.
window.addEventListener('signocore-consent:preferences-closed', () => { document.body.classList.remove('consent-window-open'); });