Home / Docs / Blocks & shortcodes

Blocks and shortcodes

The ClearCrumb cookie policy shortcode, [clearcrumb_cookie_policy], prints your full cookie policy and keeps it up to date by itself. ClearCrumb has two blocks and two matching shortcodes: one for the policy and one for a link that reopens the cookie settings. Use the blocks in the block editor and the shortcodes in page builders, widgets or classic pages.

What does the cookie policy shortcode show?

Each block has a shortcode twin that shows the same thing. Pick whichever fits the editor you use:

Block Shortcode What it shows
Cookie policy [clearcrumb_cookie_policy] Your full cookie policy: categories, every service with its cookies and purpose, how long consent is kept, and how to change it.
Cookie settings link [clearcrumb_preferences] A link that opens the banner’s preferences, so visitors can change their choice.

The policy itself has these parts, in this order:

  • a Last updated line;
  • What cookies are, in plain words;
  • How we ask for your consent, which matches your region rules (asked first in the EU, the EEA, the UK and Switzerland; an opt-out with Global Privacy Control for the US when you choose it);
  • how long the choice is stored in the clearcrumb_consent cookie, and how long the consent log keeps a record of it;
  • Change your choice, with a link that opens the cookie settings;
  • Cookies and services we use: one heading per category (Necessary, Preferences, Statistics, Marketing) with a table of service, provider and cookies;
  • More about your personal data, a link to your privacy policy, when one is set under Settings → Privacy.

How do I add the cookie policy to a page?

The quickest way is to let ClearCrumb do it. On the Banner screen, next to Cookie policy page (URL), click Create a cookie policy page for me. ClearCrumb publishes a page called “Cookie Policy” with the cookie policy shortcode in it and links it in the banner. The setup wizard offers the same with Create a cookie policy page.

If a page that already holds the shortcode exists, ClearCrumb reuses it rather than making a second one, and publishes it if it was a draft. You can then edit the page title, add your own introduction above the policy, or move it in your menus.

To place the policy yourself, add the Cookie policy block in the block editor, or paste [clearcrumb_cookie_policy] into a shortcode widget or a page builder’s text or shortcode element. The block can be used once per page and supports wide and full alignment plus margin and padding. Then enter the page address under Cookie policy page (URL) so the banner links to it.

How does the policy update itself?

The policy is built from the services you have on the Services & cookies screen. Add or remove a service, or run the scanner, and the policy page changes with it. You never copy cookie lists by hand.

The cookie policy shortcode does not store a copy of the text. It builds the policy each time the page is shown, from your current services, region rules, consent cookie lifetime and consent log retention. If you use a page cache, clear it after changing services so the cached page shows the new list; see Cache plugins.

The policy comes in English, German, French, Dutch, Spanish and Italian and follows the site language. Other languages get the English policy. To find the services your site really uses, run the WordPress cookie scanner first.

Cookie policy shortcode flow: services you add or the scanner finds go straight into the policy page, which rebuilds itself for every visitor

Visitors must be able to change their mind as easily as they said yes. The EDPB guidelines on consent say withdrawing consent should be as easy as giving it. A cookie settings link in your footer is the usual way to offer that.

Add the Cookie settings link block to your footer template part, or put [clearcrumb_preferences] in a footer widget or page builder footer. The link opens the banner’s preferences, where visitors can switch categories on or off. The block also takes text and background colour, link colour, font size, margin and padding, so it matches your footer.

ClearCrumb also has a floating “cookie settings” button, which you can switch on in the Banner screen. A footer link and the floating button can be used together.

The default link text is “Cookie settings”. In the block, click the link and type. In the shortcode, use the text attribute:

[clearcrumb_preferences text="Privacy choices"]

The default text is translated with the rest of the banner; text you type yourself is shown as written.

Yes. Any link or button with the class clearcrumb-open-preferences opens the preferences too, so you can use your theme’s own menu items. An element with the attribute data-clearcrumb-open works the same way.

For a classic menu item, turn on CSS Classes under Screen Options in Appearance → Menus, then type the class into the menu item. In the block editor, add it under Advanced → Additional CSS class(es). Developers can call ClearCrumb.open() from JavaScript (see Hooks & WP-CLI).

Cookie policy shortcode or block: blocks suit the block editor, shortcodes suit page builders, widgets and classic pages

Where should I use the cookie policy shortcode instead of the block?

Use the blocks wherever the block editor or Site Editor is available: they show a preview and give you the style controls. Use the cookie policy shortcode in page builders such as Elementor or Divi, in classic editor pages, and in widget areas that take a shortcode.

Both print the same policy, so you can switch later without losing anything. Use the cookie policy shortcode or block on one page only, and link that page in the banner, so visitors always find a single, current policy. ClearCrumb helps you meet consent rules; it is not legal advice.

Cookie policy shortcode: questions

Do I have to update the cookie policy shortcode page when I add a service?

No. The page rebuilds itself from the Services & cookies screen. Only clear your page cache if you use one.

Can I add my own text to the policy page?

Yes. Write above or below the block or shortcode; ClearCrumb only fills in its own part.

Why is my policy in English on a Polish site?

The policy ships in English, German, French, Dutch, Spanish and Italian. Other languages get the English policy, while the banner itself is in 16 languages; see Translations.

What does the settings link do if the visitor never answered the banner?

It opens the same preferences, so the visitor can make a first choice there.