Content · Gutenberg
Content Warning block for WordPress
Editorial content advisory or sensitivity notice, optionally collapsible.
Get Blockenberg
Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.
What it actually does
Editorial content advisory or sensitivity notice, optionally collapsible.
Inspector panels on this block: Warning Settings, Style & Spacing. Those titles come from index.js, not from a shared template.
Behavior controls: “Warning Type” options: Sensitive Content, Spoiler, Mature / 18+, Trauma / Distressing, Custom; “Style & Spacing — Style” options: Box (filled), Banner (accent stripe), Pill badge, Outline (no fill).
Where to find it
Gutenberg inserter → Content → search “Content Warning” (block name `blockenberg/content-warning` in block.json). Style it in the sidebar after insert.
How to use Content Warning block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “Content Warning”, insert it. Category: Content.
- Configure inspector controls that exist on this block. Open Warning Settings. Set “Warning Type”, “Label Text”, “Show Icon”, “Topics (comma-separated)”.
- Check the published page. The view script reads HTML data attributes: data-opts, data-rendered. The block editor preview may not run the same view script.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| Warning Type | Select control; the chosen value is saved on the block. Options: Sensitive Content; Spoiler; Mature / 18+; Trauma / Distressing; Custom. block.json default: sensitive. Saved as `warningType`. |
| Label Text | Text field in the inspector. block.json default: Content Warning. Saved as `label`. |
| Show Icon | On/off toggle in the inspector. On by default. Saved as `showIcon`. |
| Topics (comma-separated) | Text field in the inspector. Saved as `topics`. |
| Show Extended Message | On/off toggle in the inspector. On by default. Saved as `showMessage`. |
| Collapsible (hide content until confirmed) | On/off toggle in the inspector. Off by default. Saved as `collapsible`. |
| Button Label | Text field in the inspector. block.json default: I understand — show content. Saved as `buttonLabel`. |
| Style & Spacing — Style | Select control; the chosen value is saved on the block. Options: Box (filled); Banner (accent stripe); Pill badge; Outline (no fill). block.json default: box. Saved as `style`. |
| Border Radius | Numeric range control in the inspector. Range 0–40. block.json default: 8. Saved as `borderRadius`. |
| Padding Top | Numeric range control in the inspector. Range 0–100. block.json default: 0. Saved as `paddingTop`. |
| Padding Bottom | Numeric range control in the inspector. Range 0–100. block.json default: 0. Saved as `paddingBottom`. |
| Colors — Background | Color control in the inspector. block.json default: #fef2f2. Saved as `bgColor`. |
| Colors — Border | Color control in the inspector. block.json default: #fca5a5. Saved as `borderColor`. |
| Accent | Color control in the inspector. block.json default: #dc2626. Saved as `accentColor`. |
| Label Text | Color control in the inspector. block.json default: #7f1d1d. Saved as `labelColor`. |
| Message Text | Color control in the inspector. block.json default: #450a0a. Saved as `textColor`. |
| Topic Tag Background | Color control in the inspector. block.json default: #fee2e2. Saved as `topicBg`. |
| Topic Tag Text | Color control in the inspector. block.json default: #991b1b. Saved as `topicColor`. |
| Button Background | Color control in the inspector. block.json default: #dc2626. Saved as `btnBg`. |
| Button Text | Color control in the inspector. block.json default: #ffffff. Saved as `btnColor`. |
| Label | Shared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoLabel`. |
| Message | Shared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoMessage`. |
What the front-end script actually does
- The view script reads HTML data attributes: data-opts, data-rendered.
When this is the right block
- Editorial content advisory or sensitivity notice, optionally collapsible — that is the job of Content Warning, not a generic content block.
- Use it when you need the editor control labeled “Warning Type”, which exists on this block’s inspector.
- It matches pages about warning, content warning, trigger.
- Inserter grouping: articles, cards, lists, and long-form layouts.
Notes from the implementation
viewScript: this folder’s frontend.js is enqueued on the front end for this block.
FAQ
How do I add the Content Warning block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Content Warning”. It sits under Content. After insert, open Warning Settings and set “Warning Type”, “Label Text”, “Show Icon”, “Topics (comma-separated)”.
What makes Content Warning different from other Blockenberg blocks?
Editorial content advisory or sensitivity notice, optionally collapsible. Inspector labels on this block include “Warning Type”, “Label Text”, “Show Icon”, “Topics (comma-separated)”.
Is the Content Warning Gutenberg block free?
Yes. Content Warning ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style Content Warning to match my theme?
Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Warning Settings, Style & Spacing).
Related content blocks
Alert / Notice
Info, success, warning or error notice block with icon, title and body text. Pure CSS — zero JS.
Callout
Highlighted panel for tips, warnings or success messages with icon, title and dismissible option.
Content Box
Styled content container with optional icon/emoji, badge label, title, rich body text, style variants (info/warning/success/tip/quote), border, background, and rounded corners.
Spoiler / Reveal
Hide content behind a click-to-reveal button. Perfect for spoilers, quiz answers, bonus tips, or any content that should stay hidden until the reader chooses to see it.
Toggle / Read More
A single expandable panel for 'Read More', spoilers, or collapsible content sections.
Accordion
Collapsible accordion panels for FAQ, features, and more.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert Content Warning from the Gutenberg inserter.