=== Consent Warden ===
Contributors: linuxgnut
Tags: cookie consent, gdpr, privacy, cookie banner, ccpa
Requires at least: 5.9
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Simple cookie consent banner for GDPR and CCPA compliance. Customisable text, colours, and privacy policy link. Fires a JS event on accept.

== Description ==

Consent Warden adds a clean, accessible cookie consent banner to your WordPress site. Visitors see a simple Accept button with an optional link to your privacy policy. Once accepted, the banner disappears and consent is remembered for up to a year.

**Free edition features:**

* Accept-only banner — no unnecessary complexity
* Three layout positions: bottom bar, bottom-left card, bottom-right card
* Customisable heading, message text, and button label
* Optional privacy policy link (URL and link text)
* Six colour options: background, text, link, accept button, button text, and hover
* Configurable consent expiry (1–3650 days, default 365)
* Fires a `cwarden:consent` JavaScript event on accept — hook your own scripts to it
* Accessible: `role="region"` and `aria-label` on the banner element
* Zero external dependencies on the frontend
* Consent stored in a `cwarden_consent` cookie with `SameSite=Lax`
* No data sent to the server — consent stays on the visitor's device

**Upgrade to Standard or Pro for:**

* Granular consent categories (Analytics, Marketing, Preferences) with per-category toggles
* Script blocking — prevent third-party scripts from loading until consent is given (soft dequeue and hard HTML rewrite)
* Google Consent Mode v2 integration (gtag / GTM)
* Full consent log — record and review visitor consent decisions
* Geo-targeting — show the banner only to visitors in targeted regions (EU, UK, US, Brazil, and custom country lists)
* Automatic cookie scanner — passively discover and categorise cookies set on your site

Learn more about the Standard and Pro editions at https://linuxgnut.com/projects/consent-warden/

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/consent-warden/`, or install directly through the WordPress Plugins screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **Settings → Consent Warden** to configure the banner text, colours, and privacy policy link.
4. The banner appears on your site until a visitor clicks **Accept**.

No coding required. The banner is ready to use immediately after activation with sensible defaults.

== Frequently Asked Questions ==

= Does this plugin block scripts or cookies until consent is given? =

Not in the free edition. The free edition displays a consent notice and records acceptance via a browser cookie. Script blocking (preventing analytics or marketing scripts from loading before consent), Google Consent Mode v2, and per-category consent management are available in the paid editions.

= Where is consent stored? =

Consent is stored in a browser cookie named `cwarden_consent` on the visitor's device. No consent data is sent to the server or stored in the WordPress database. The cookie uses `SameSite=Lax` and expires after the number of days you configure (default: 365).

= What JavaScript event fires when a visitor accepts? =

The plugin dispatches a `cwarden:consent` CustomEvent on `document` when the visitor clicks Accept. You can listen for it in your own scripts:

`document.addEventListener('cwarden:consent', function(e) { /* your code */ });`

= Is this plugin GDPR compliant? =

This plugin provides the consent mechanism — the banner and cookie — that GDPR requires before setting non-essential cookies. Actual compliance depends on your site as a whole: your privacy policy, the cookies your site sets, and how you process visitor data. Consult a legal professional for advice specific to your situation.

= Will this conflict with other cookie consent plugins? =

You should only run one consent plugin at a time. Deactivate any other cookie consent or GDPR plugins before activating Consent Warden.

= How do I reset or remove the banner for a specific visitor? =

The visitor can clear their browser cookies. Alternatively, you can delete the `cwarden_consent` cookie from your browser developer tools to see the banner again.

= How do I remove all plugin data on uninstall? =

Deleting the plugin from the WordPress Plugins screen removes all saved settings (`cwarden_settings` option) from the database automatically.

= Does the banner work with page caching? =

Yes. The banner is rendered in the footer via PHP and shown or hidden client-side based on the consent cookie. It is compatible with full-page caching plugins (WP Super Cache, W3 Total Cache, WP Rocket, etc.) because the consent check runs in the visitor's browser, not on the server.

== Screenshots ==

1. The settings page showing banner text, privacy policy link, and colour customisation.
2. The remaining settings page showing banner text, privacy policy link, and colour customisation.
3. The consent banner in bottom-bar position with the default styling.
4. The consent banner in bottom-bar position with the default styling and a privacy policy link.

== Changelog ==

= 1.0.1 =
* Tested with WordPress 7.1.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
