Blocks, WP Consent API bridge, and VIP cache behavior.
Bootstrap
Loader → Plugin → Consent_API_Handler, Cookie_Scanner, VIP_Compatibility, and both block classes. WP Consent API hooks register at plugins_loaded priority 20. Local environments load block PHP from src/; other environments load from build/.
Client-side visibility
Banner visibility initializes to false in server-rendered Interactivity API state. callbacks.onInit in the browser decides whether to show the banner using Global Privacy Control → WP Consent API → localStorage fallback. That order keeps VIP edge cache from baking one visitor’s consent into HTML for everyone else.
Runtime helper: window.prcCookieBanner (show, hide, handleConsent, getState, getActions, setConsent, getConsent, checkConsent).
Consent categories
| Index | WP Consent API category | Label |
|---|---|---|
| 0 | functional | Essential |
| 1 | statistics | Analytics |
| 2 | marketing | Marketing |
| 3 | preferences | Preferences |
With WP Consent API v2, default marketing services include meta, pinterest, linkedin, and reddit. Extend via prc_privacy_consent_services.
VIP compatibility
VIP_Compatibility varies edge cache on consent cookies (wpcom_vip_cache_vary_headers), sends X-Batcache: no on plugin AJAX, and refreshes the cookie list via AJAX when the cookie-list block is present so listings stay accurate behind cache.
Key hooks
| Hook | Role |
|---|---|
prc_privacy_consent_consent_updated | After visitor submits consent |
prc_cookie_banner_register_cookies | Register cookies with WP Consent API |
prc_cookie_list_categories | Mutate categories before cookie-list render |