Clear Known Keys#
List only the keys that belong to optional scripts:
{{ cookie_consent analytics_cookies="_ga,_gid" analytics_storage="analytics_user" marketing_cookies="_fbp"}} <section> ... </section>{{ /cookie_consent }}This clears those names when the visitor rejects optional categories or saves preferences with those categories off.
Session Storage#
Use *_session_storage for session storage keys:
{{ cookie_consent analytics_session_storage="analytics_session" }} <section> ... </section>{{ /cookie_consent }}What TemplateX Does Not Clear#
TemplateX does not blanket-delete cookies or storage.
It does not delete:
- WordPress login cookies
- cart or checkout session cookies
- server-required session data
- keys you did not list
Limits#
Consent gating works before a script runs. Scripts that are not marked with data-consent can still run and store data.
Browser JavaScript cannot delete HttpOnly cookies, cannot reliably delete cookies set for unknown domains or paths, and cannot stop cookies that the server already sent with the current response.
This feature provides the technical consent mechanism for a theme. It is not a legal compliance guarantee.