Description
Diáfana shows an opt-in consent banner (every optional category is off by default), blocks recognised or manually classified resources according to their consent category, and lets you style every detail with a real-size live preview.
- Cookie scanner: detects cookies and third-party services (analytics, pixels, fonts, embeds).
- Per-cookie control: allow (follows its category) or block always, without breaking the script that uses it.
- Blocking for recognised/classified scripts, iframes and fonts; browser and server guards for registered cookies.
- Google Consent Mode v2 and WP Consent API.
- Polylang, WPML, TranslatePress, Weglot and Google Translate widgets. Loco Translate ready (.pot included).
- Translation-ready through WordPress.org language packs. Banner texts can be customised per language; English is the fallback when a translation is unavailable.
- Optional proof-of-consent log without IP addresses, CSV export.
- Under 6 KB of deferred banner JavaScript (gzip), a separate cacheable stylesheet, no JavaScript dependencies and no layout shift.
Shortcodes: [diafana_cookies] (cookie table) and [diafana_settings] (reopen preferences).
JavaScript API: Diafana.open(), Diafana.get(), Diafana.accept(), Diafana.reject() and the diafana:consent document event.
Manual blocking of any script: <script type="text/plain" data-diafana="a"> (p = preferences, a = analytics, m = marketing).
This plugin helps you comply with privacy laws but does not constitute legal advice.
External services
Diáfana loads its own JavaScript and CSS from your WordPress site and sends its REST requests to that site. It has no vendor account, remote cookie database, telemetry or connection to Studio Tere.
The URLs and domains in includes/data-known.php (Google Analytics/Tag Manager/Maps/Fonts, Meta, Stripe and others) are local detection patterns. The plugin does not fetch those URLs, install their tags or transmit visitor data to every listed provider.
When an administrator starts a scan, the server fetches selected pages of the configured site (safe HTTP requests may follow redirects). The admin browser also opens site pages in scan iframes with consent blocking bypassed for that authorised scan. Existing third-party tags on those pages can consequently make their normal provider requests and set cookies. Cookie names and detected service IDs are submitted to the same-site scanner REST endpoint; resource URLs are examined in the admin browser. Review the existing providers before scanning.
Optional Google Consent Mode v2 integration: when enabled in settings, Diáfana queues consent defaults and updates locally through window.gtag/dataLayer, or through the optional GTM consent bridge. It does not load Google tags or make a Google network request itself. If you separately install Google tags, those tags can send consent signals, identifiers and measurement data to Google according to their configuration; some configurations send cookieless pings while consent is denied. Consent Mode alone is not a guarantee of zero pre-consent requests.
Google terms: https://marketingplatform.google.com/about/analytics/terms/us/
Google privacy: https://policies.google.com/privacy
Google Tag Manager terms: https://marketingplatform.google.com/about/analytics/tag-manager/use-policy/
Google Consent Mode documentation: https://developers.google.com/tag-platform/security/concepts/consent-mode
Privacy
The plugin stores one first-party cookie, diafana_consent, with the visitor’s choices and a random consent ID. When the consent log is enabled, the same ID, the choices, the date, the language and the page path are stored in the site database. No IP address is stored in the consent log and nothing is sent to the plugin author. A random consent ID and page path can still be personal data in context. Hosting access logs and separately installed providers are outside the plugin’s consent log.
Installation
- Upload the plugin from Plugins → Add New → Upload Plugin, or install it from the directory, and activate it.
- Open Diáfana in the admin menu and run “Scan site” in the Cookies tab.
- Review the detected cookies and services and choose what is blocked until consent.
- Style the banner in the Appearance tab using the live preview, and adjust the texts if needed.
- Link your legal pages in the Legal tab and save.
FAQ
Does the banner slow my site down?
The banner has under 6 KB of deferred JavaScript (gzip), a cacheable local stylesheet and small inline settings. It loads no third-party assets. The decision to show the banner is made in the browser, so cached pages can be shared between visitors. Automatic processing of template HTML uses the native WordPress 6.9 buffer and can increase time to first byte on uncached pages.
Are optional cookies really off by default?
The consent state for preferences, analytics and marketing is denied until the visitor enables them. Enforcement covers recognised/classified resources and registered cookies; unknown resources, dynamically inserted tags and third-party/HttpOnly cookies outside the site response need their own integrations. Review the scanner results and test the actual network requests. Accept and Reject have the same style and size.
What happens before I run the scanner?
With script blocking enabled, resources matching the known service patterns are blocked according to their category. Cookie guards apply to registered cookies. Unknown cookies are shown as “Unclassified” and remain uncontrolled until you classify them. Run the scanner, review its results, classify unknown items and verify that the site respects each choice. The scanner is a sample, not an exhaustive audit.
What if my site streams HTML or inserts tags dynamically?
The native template buffer may be disabled by other code. Standard WordPress-enqueued scripts and styles are also filtered, but raw template tags then require manual blocking. Scripts inserted later by JavaScript and tags outside the template need manual blocking or consent-aware tag-manager rules. Use <script type="text/plain" data-diafana="a"> for manual analytics blocking. The consent guard is queued before normal head scripts; tags hard-coded before the guard must be moved after it.
Where are translations installed?
WordPress.org language packs are managed by WordPress under wp-content/languages/plugins. No compiled translations are bundled. Custom banner texts already saved in Diáfana are retained. If a pack or locale is unavailable, untranslated defaults are English; edit the banner texts for any required language.
Does it work with Google Consent Mode v2?
Yes. The default state is “denied” and it is updated when the visitor chooses. The plugin is not a Google-certified CMP and does not implement the IAB TCF, which Google requires for publishers serving ads through AdSense, Ad Manager or AdMob in the EEA, the UK and Switzerland.
Where are consent records stored?
In your own WordPress database. Each acceptance, change or withdrawal is a new line with a random consent ID, the choices, date, language and a copy of the banner text shown. No IP address is stored. You can search by ID, export CSV and download the evidence for one ID. The log can be turned off in the Legal tab.
Which multilingual plugins are supported?
Polylang, WPML, TranslatePress and Weglot are detected automatically. Every banner text can be edited per language, new languages can be added, and the plugin can be translated with Loco Translate.
Can a cookie the site needs be blocked by mistake?
No. WordPress login, session, cart and consent cookies are locked as necessary and cannot be disabled.
Does uninstalling remove the data?
Yes. Deleting the plugin removes its options and its two database tables, including the consent records. Export them first if you need to keep them.
Changelog
1.1.6
- Requires WordPress 6.9 or later.
- Enqueues front-end CSS/JavaScript with WordPress APIs; the stylesheet is cacheable.
- Replaces the private output buffer and regex rewriting with the native template filter and HTML API.
- Clarifies classified/unknown resources, scanner behaviour and external integrations.
- Uses WordPress.org language packs instead of bundled translation files; custom texts are retained.
1.1.5
- Scanner bypass requires administrator permissions and a valid nonce.
- Existing denied cookies are cleaned on load and along current path prefixes.
- Restored choices synchronise Google Consent Mode and the WP Consent API.
- Evidence references the banner actually displayed, including cached pages.
- Consent logging has a fetch fallback and stricter input validation.
- LiteSpeed and WP Rocket page caches are invalidated on configuration changes.
- Development GTM template uses the native consent APIs. See integrations/gtm/README.md.
- Google/IAB certification has not been obtained. TCF is not implemented.
1.1.4
- Database table names are passed as prepared identifiers (requires WordPress 6.2).
- Bundled translations are loaded explicitly instead of through load_plugin_textdomain().
1.1.3
- Necessary category shows an “Always active” label instead of a switch; its cookie list in the banner is now optional.
1.1.2
- Portuguese added (banner and admin).
1.1.1
- Legal links can point to pages, posts or any public custom post type.
- Scanner: services are recognised in the browser (no URL lists sent to the server) and errors show their real cause.
1.1.0
- Proof of consent: full history per consent ID, copy of the banner text shown, search and evidence download.
- Visitors can see their consent ID and date in the preferences panel.
- Button text weight control. Preview fits the window height.
1.0.0
- First release.