Skip to main content
The Katla Cookie Consent plugin brings GDPR, CCPA/CPRA and DMA compliance to WordPress and WooCommerce. It loads Katla’s consent script, blocks non-consented scripts and embeds on the server, and renders the cookie and privacy policies Katla generates for you.

Prerequisites

If you haven’t added a domain yet, start with the quickstart.

Install

Copy the plugin into wp-content/plugins/katla-consent, activate it, then set your Site ID:
Or paste the Site ID into Settings → Katla Consent.
wp katla verify confirms the Site ID resolves against Katla. If it fails, the site has probably not completed a scan yet — the plugin needs cookie data to render policies.

Modes

The default. Loads https://dist.katla.app/{siteId}.js, and Katla renders the banner and preferences dialog styled from your dashboard. Nothing to build.

Blocks and shortcodes

Every shortcode has a matching Gutenberg block. [katla_policy] renders on the server by default, so the policy is part of the page HTML and indexable by search engines. Pass render="client" to use Katla’s hosted policy.js instead.

Blocking scripts

This is the part worth understanding properly. Katla’s cookie guard stops cookies from being written. It does not stop a tracker from loading in the first place. For scripts that phone home regardless of whether they can set a cookie, gate the script itself — on the Blocking tab, or from code:
A blocked handle is rewritten to <script type="text/plain" data-katla-src="…" data-katla-category="analytics">. Inline scripts attached to the same handle via wp_add_inline_script are neutralised alongside it and replayed in source order once the category is allowed, so tag configuration is never lost. You can also match on URL fragments rather than handles, which is useful for scripts a theme or plugin injects without registering.

WooCommerce

The plugin declares compatibility with HPOS (custom_order_tables) and the cart/checkout blocks. Store-critical cookies bypass the cookie guard automatically — woocommerce_cart_hash, woocommerce_items_in_cart, wp_woocommerce_session_*, wc_cart_hash_*, wc_fragments_*, store_notice* and friends. Store-critical script handles (wc-cart-fragments, wc-checkout, wc-blocks-checkout) are stripped from the blocked list, so a stray blocking rule can’t break checkout.
Order attribution cookies (sbjs_*) are deliberately not allowlisted — they are marketing cookies. To stop them being set at all, gate the wc-order-attribution handle on the Blocking tab.
Optionally, the plugin appends a cookie settings link to the checkout and registration privacy notice, and to the My Account dashboard.

JavaScript API

window.KatlaConsent is Katla’s own API — see the JavaScript API reference. The plugin adds:
It dispatches the SDK-compatible event on every change:
The plugin takes ownership of KatlaConsent.onConsentChange as a subscriber list, so assigning to it — as @katla.app/sdk’s ConsentBridge does — adds a listener rather than replacing the plugin’s.

Markup contract

Anything the plugin holds back is marked up so you can style or extend it:

Customizing

The plugin exposes PHP helpers and a set of filters. The most useful ones: Restyling the built-in banner to match your theme:
PHP helpers are available for building your own templates:
The complete list of filters and actions is in the plugin README.

WP-CLI

Caching

Cookie and policy responses are cached in transients — 12 hours by default, configurable on the Policies tab, or 0 to disable. The cache is cleared when settings are saved, from the Tools tab, via wp katla flush, and on deactivation.

Compliance notes

Load order matters. The cookie guard must run before any script that sets cookies. Keep the placement on Head, and exclude dist.katla.app from JS deferral or combination in optimisation plugins such as WP Rocket or Autoptimize. Deferring the guard is the single most common way a WordPress install ends up non-compliant while looking fine. Equal prominence. In the built-in banner, “Reject all” and “Accept all” use identical size, padding and weight, so neither is the nudged choice. This is a DMA requirement and a growing expectation under GDPR enforcement. Hide from roles is for development. Users in those roles see no banner and no consent record is created for them. Don’t leave it enabled for a role that real visitors have.

Next steps

Google Consent Mode

Signal consent to Google Analytics and Ads.

JavaScript API

The full window.KatlaConsent surface.

Policy embed

Other ways to publish your generated policies.

Plugin source

Issues, releases, and the full hook reference.