Written for Cookie Rocks 2.9.5, checked on 1 November 2026. The current version is 2.11.2: some details may have changed.
What you can do here
- Place the cookie policy and a “Manage cookies” link in your theme, with shortcodes.
- Hold your own scripts until consent, and react to the visitor’s choice, with JavaScript.
- Change texts, categories, known cookies and the look of the banner, with PHP filters and CSS.
This section lists every shortcode, hook, REST route, constant and JavaScript event of the plugins, and says which plugin provides each one.
Two plugins
| Cookie Rocks Audit | Cookie Rocks Pro | |
|---|---|---|
| Price | Free | Paid, with a free trial |
| Plugin folder | cookie-rocks | cookie-rocks-banner |
| Constant defined when active | COOKIE_ROCKS_VERSION | COOKIE_ROCKS_BANNER_VERSION |
| Text domain | cookie-rocks | cookie-rocks-banner |
| On your visitors’ pages | Nothing, except the cookie policy where you place its shortcode | The banner, the cookie button, the blocking of trackers, the consent signals |
Cookie Rocks Pro works on top of the Audit. Without the Audit active, it does nothing on your site and offers to install it. Both plugins keep their settings in one shared option, cookie_rocks_settings, and share the Cookie Rocks menu.
To run code only when Pro is there:
if ( defined( 'COOKIE_ROCKS_BANNER_VERSION' ) ) {
// Cookie Rocks Pro is active: the banner, window.CookieRocks and the PHP filters of the banner exist.
}
What you can use
| Page | Audit | Pro |
|---|---|---|
| Shortcodes | [cookie_rocks_policy] | [cookie_rocks_policy], [cookie_rocks_link], and the other ways to reopen the choices |
| PHP filters, actions and REST API | Filters on categories, known cookies, news and checks; one action after each admin page | Filters on texts, configuration, Google Consent Mode, optimisation and protected pages; one action for accounts managed outside WordPress; three REST routes, for the register of proofs and the rules by country |
| JavaScript API and events | None: the Audit adds no script for visitors | window.CookieRocks, DOM events, Google Tag Manager events, holding your own scripts and frames |
| CSS (below) | None: the policy takes the style of your theme | Variables and classes of the banner |
The Developers page of the admin lists the 675 tools whose cookies Cookie Rocks knows. For a tool it does not know, hold its script with a few HTML attributes, or add it to the catalogue with the cookie_rocks_services filter.
Constants
| Constant | Set by | Plugin | Use |
|---|---|---|---|
COOKIE_ROCKS_VERSION | The plugin | Audit | Version of the Audit. Defined when the Audit is active. |
COOKIE_ROCKS_BANNER_VERSION | The plugin | Pro | Version of Cookie Rocks Pro. Defined when Pro is active. |
COOKIE_ROCKS_API | You, in wp-config.php | Pro | Another address for the Cookie Rocks key service, for tests. Pro then sends there every call about the key, such as confirming it and checking for updates. End it with a slash. Leave it undefined on a live site. |
SCRIPT_DEBUG | You, in wp-config.php | Pro | A WordPress constant. When true, Cookie Rocks Pro serves its readable scripts and stylesheets instead of the minified ones. |
// wp-config.php, test site only.
define( 'COOKIE_ROCKS_API', 'https://keys.example.test/wp-json/cookierocks/v1/' );
Change the look with CSS
This applies to the banner of Cookie Rocks Pro. Start with the Appearance page: colours, corners, distance from the edges and shadows are settings there. Use CSS for what the page does not offer.
- Open the place where your site keeps its own CSS: Appearance, Customize, Additional CSS (classic themes), Appearance, Editor, Styles, Additional CSS (block themes), the custom CSS field of your theme or page builder, or your child theme.
- Write your rules on
.cr-root[data-theme], so that they apply in the light and dark themes. - For a variable that the Appearance page also sets, add
!important. See why below.
/* Square corners and a lighter shadow, in light and dark themes */
.cr-root[data-theme] {
--cr-radius: 6px !important;
--cr-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}
/* Buttons in capital letters */
.cr-root .cr-btn {
text-transform: uppercase;
letter-spacing: .04em;
}
If your CSS value is ignored. The banner writes the values chosen on the Appearance page in the style attribute of .cr-root: --cr-accent, --cr-accent-text, --cr-accent-ink, --cr-accent-dark (when the accent lacks contrast in the dark theme), --cr-radius, --cr-gap, and --cr-sh when Shadows is off. These inline values win over your stylesheet. A value left at its default is not written, so a rule without !important works only while that setting stays at its default (for example Rounded corners at 20). Add !important, or change the setting on the Appearance page.
Variables
| Variable | What it sets |
|---|---|
--cr-accent | Accent colour: buttons and switches. Set it on the Appearance page. |
--cr-accent-text | Text on the accent colour. Chosen automatically to stay readable. |
--cr-bg | Background of the banner and the details. |
--cr-fg | Main text. |
--cr-muted | Secondary text. |
--cr-line | Borders and separators. |
--cr-soft | Light backgrounds: the “Let me choose” button, the categories. |
--cr-track | Switches that are off. |
--cr-shadow | Shadow of the banner and the details. When Shadows is off, no shadow is shown, whatever this value. |
--cr-radius | Rounded corners, in pixels (0 to 32, 20 by default). Set it on the Appearance page. |
--cr-gap | Distance between the banner and the screen edges, in pixels (0 to 40, 20 by default). Set it with Distance from the screen edges on the Appearance page. At 0, the box sits in the corner. The bar layout does not use it. On phones, the distance is 8 px at most. |
Classes
| Class | What it is |
|---|---|
.cr-root | Container of everything. Attributes: data-theme (auto, light, dark), data-layout (box, bar), data-position (left, right). |
.cr-banner | The banner. |
.cr-eyebrow, .cr-title, .cr-text | Site name, title and text of the banner. |
.cr-btn--solid | “Reject all” and “Accept all” buttons (same look, as the law requires). With Highlight “Accept all” on the Appearance page, “Reject all” becomes .cr-btn--outline. |
.cr-btn--soft | “Let me choose” button. |
.cr-dialog | The details window, with .cr-cat for each category and .cr-switch for the switches. |
.cr-widget | The cookie button. |
.cr-toast | The short message after a choice. |
.cr-form-notice | The request shown above forms protected by reCAPTCHA. |
.cr-manage-link | The “Manage cookies” link of the shortcode. |
Video and map placeholders are drawn inside their own frame: they follow the accent colour, not your CSS.
Next step: Shortcodes.