Wiozen Market

How do you add a cookie notice to a WordPress site without a plugin, and does it stop ad and analytics code?

In short:In Wiozen Theme the cookie notice is turned on from the Cookie notice card on the Settings tab; no plugin is needed. It shows visitors a message with Accept and Reject buttons and keeps their choice in the browser for a year. It does not stop ad or analytics code: whatever you paste into Site codes and the ad slots keeps running even if the visitor presses Reject. The notice is an information and record-keeping tool and does not guarantee legal compliance.

Turning the notice on

The notice is off by default. Under Appearance › Wiozen Theme, open the Settings tab and switch on "Show the cookie notice" in the Cookie notice card. The card has these fields:

  • Message: the text in the banner, up to 600 characters. If you leave it empty it reads "This site uses cookies to improve your experience. See the Cookie Policy for details."
  • Policy page: the page linked beside the message. It has to be a published page. If you choose none, the Privacy Policy page you set under Settings › Privacy in WordPress is used; if there is none, no link is added.
  • Accept button and Reject button: the button labels, up to 40 characters. Empty means "Accept" and "Reject".
  • Position: Bottom bar or Bottom-left box.

The notice shows on the site right after you save. The theme doesn't write the policy text; you prepare the policy page yourself. Once published, it appears in the footer's pages column automatically, which the footer article explains. The settings stay put when the theme updates (update article).

What happens when a visitor presses a button?

The banner appears only if the visitor hasn't made a choice before. Pressing a button closes it and stores the choice (accepted or rejected) in a cookie named wiozen-cookie-consent and in the browser's local storage. The cookie lasts 365 days. When the visitor comes back in the same browser, the banner doesn't show again. The banner is revealed with JavaScript, so in a browser without JavaScript it never appears.

The banner script loads only when the notice is on: with the notice off, nothing is added to the page for it.

Does it stop ad and analytics code?

No. Whatever you put in the two fields under Settings › Site codes (In the page head and At the end of the page) and whatever you paste into ad slots is printed on the page without looking at the cookie choice. Nothing in the theme holds those codes back until a visitor accepts. If a visitor presses Reject, the theme only records it; Google Analytics or AdSense code runs as usual.

When a button is pressed the theme fires an event named wiozen:cookie-consent in the browser (the choice is in detail.choice: accepted or rejected). Nothing in the theme listens for it and ties code to it. You can read that event or the cookie in your own script and load your code from there, but that's development work, and if it's set up wrong the code either never loads or loads too early. The event fires only at the moment of the click; on later pages you have to read the choice from the cookie.

In practice there are two routes. If your code must not run before the visitor consents, install a consent management (CMP) plugin that holds scripts back until consent, and turn off the theme's banner so the two don't stack. If you only want to inform visitors, the theme's banner may be enough, but whether it's enough in your country and for the cookies you use is for a lawyer to decide.

AdSense is a separate case: if you show ads to visitors in the European Economic Area, the UK or Switzerland, Google asks for a Google-certified CMP. The theme's banner isn't one; details are in the AdSense article. To see where the Analytics code goes, read the Analytics and Search Console article.

Does this banner make you legally compliant?

We don't guarantee that. When a cookie notice is required and how valid consent has to be collected differs by country and by the cookies you use. The theme's banner informs the visitor and records the choice; because it doesn't hold code back, it doesn't block services that set cookies before consent. If you need legal compliance, review your policy text and your cookie setup with a lawyer.

What do you need to reach this setting?

The theme is a free download and works on unlimited sites. The Settings tab is in the theme panel, which opens once you connect the site to your Wiozen account; there's no fee or top-up. If the license lapses the panel locks, but the settings you saved stay in place (license article).

Frequently asked questions

Does Google Analytics run for a visitor who presses Reject?
Yes, if you added the Analytics code under Site codes. The theme records Reject but doesn't hold the code back. If the code must not run before consent, use a consent management plugin that holds scripts until consent.
Where is the visitor's choice stored and for how long?
In a cookie named wiozen-cookie-consent and in the browser's local storage. The cookie lasts 365 days. The value is accepted or rejected.
Does the theme's banner guarantee legal compliance?
No. It informs the visitor and records their choice. A lawyer should decide whether the requirements are met in your situation.
If I use a cookie plugin, should I turn off the theme's banner?
Yes. Otherwise two banners stack and the visitor has to make two separate choices. The switch is in the Cookie notice card on the Settings tab.
Does the theme write the policy page?
No. The theme only links to the page you choose, or to the page set as the Privacy Policy in WordPress. You write the text.

For a block theme with a cookie notice and ad slots ready, download Wiozen Theme for free.

Download free