WP Manifestindependent plugin directory
manifest / content / cbp-disclaimer

CB Disclaimer

Cookie-based disclaimer popup for configurable URL paths. Uses a native HTML <dialog> element with Bootstrap 5 utilities.

★ 0stars

Install

Download source zip No release zip yet

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.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A 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

  1. Upload or clone the cbp-disclaimer folder into wp-content/plugins/
  2. Activate the plugin via Plugins → Installed Plugins
  3. 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.


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_options key
  • register_setting with a sanitize_callback handles all input sanitisation
  • Activation hook seeds default options via add_option (won't overwrite existing values)