Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/chillibyteuk/cbp-disclaimer/archive/refs/heads/main.zipA WordPress plugin that displays a cookie-based disclaimer popup on configurable URL paths. Uses a native HTML <dialog> element with Bootstrap 5 utilities for styling.
Features
- Popup appears only on configured URL path prefixes (e.g.
/investors/and all pages beneath it) - Native
<dialog>element — proper modal semantics, browser-managed backdrop, no external dependencies beyond Bootstrap 5 - Escape key suppressed — visitors must explicitly Accept or Decline
- Accept sets a cookie; popup won't reappear until the cookie expires
- Decline redirects to a configured URL (or
history.back()if left blank) - Assets only enqueued on matching pages
- Fully configurable via Settings → CB Disclaimer in wp-admin
Installation
- Upload or clone the
cbp-disclaimerfolder intowp-content/plugins/ - Activate the plugin via Plugins → Installed Plugins
- Go to Settings → CB Disclaimer and configure as required
Settings
| Setting | Description | Default |
|---|---|---|
| Enable Disclaimer | Toggle the popup on/off globally | Enabled |
| Active Paths | One URL path prefix per line. The popup shows on any page whose URL starts with a listed path. | /investors/ |
| Cookie Name | Browser cookie key written on acceptance. Alphanumeric + underscores. | cb_disclaimer_accepted |
| Cookie Duration | How many days the acceptance cookie lasts before the popup reappears. | 365 |
| Decline Destination URL | Where to send visitors who click Decline. Leave blank to go back in browser history. | (blank) |
| Disclaimer Text | The body copy shown in the popup. HTML is permitted (links, bold, paragraphs, etc.). | Placeholder investor notice |
| Accept Button Label | Label for the accept button. | Accept |
| Decline Button Label | Label for the decline button. | Decline |
Path Matching
Paths are matched by prefix. A path of /investors/ will trigger the popup on:
/investors/
/investors/reports/
/investors/reports/q1-2025/
It will not trigger on /about-investors/ — the match is anchored to the start of the URI.
Multiple paths are supported — add one per line.
Cookie Behaviour
On acceptance, a cookie is written as:
<cookie_name>=1; max-age=<duration in seconds>; path=/; SameSite=Lax
The cookie is scoped to the root path (/) so it persists across the whole site. This means accepting on /investors/ won't prompt again on /investors/funds/.
File Structure
cbp-disclaimer/
├── cbp-disclaimer.php # Main plugin file — class, WP hooks, admin UI
├── assets/
│ ├── cbp-disclaimer.css # Dialog sizing and backdrop styles
│ └── cbp-disclaimer.js # Cookie logic and dialog control
└── README.md
Requirements
- WordPress 6.0+
- PHP 7.4+
- Bootstrap 5 enqueued by the active theme (used for button and utility classes inside the dialog)
Development
The plugin follows the same conventions as other cbp-* plugins in this project:
- Single class, instantiated once via
$GLOBALS - Options stored as a single serialised array under the
cb_disclaimer_optionskey register_settingwith asanitize_callbackhandles all input sanitisation- Activation hook seeds default options via
add_option(won't overwrite existing values)