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.

Get Blockenberg

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

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Content Warning”, insert it. Category: Content.
  3. Configure inspector controls that exist on this block. Open Warning Settings. Set “Warning Type”, “Label Text”, “Show Icon”, “Topics (comma-separated)”.
  4. 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

ControlWhat the code does
Warning TypeSelect 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 TextText field in the inspector. block.json default: Content Warning. Saved as `label`.
Show IconOn/off toggle in the inspector. On by default. Saved as `showIcon`.
Topics (comma-separated)Text field in the inspector. Saved as `topics`.
Show Extended MessageOn/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 LabelText field in the inspector. block.json default: I understand — show content. Saved as `buttonLabel`.
Style & Spacing — StyleSelect 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 RadiusNumeric range control in the inspector. Range 0–40. block.json default: 8. Saved as `borderRadius`.
Padding TopNumeric range control in the inspector. Range 0–100. block.json default: 0. Saved as `paddingTop`.
Padding BottomNumeric range control in the inspector. Range 0–100. block.json default: 0. Saved as `paddingBottom`.
Colors — BackgroundColor control in the inspector. block.json default: #fef2f2. Saved as `bgColor`.
Colors — BorderColor control in the inspector. block.json default: #fca5a5. Saved as `borderColor`.
AccentColor control in the inspector. block.json default: #dc2626. Saved as `accentColor`.
Label TextColor control in the inspector. block.json default: #7f1d1d. Saved as `labelColor`.
Message TextColor control in the inspector. block.json default: #450a0a. Saved as `textColor`.
Topic Tag BackgroundColor control in the inspector. block.json default: #fee2e2. Saved as `topicBg`.
Topic Tag TextColor control in the inspector. block.json default: #991b1b. Saved as `topicColor`.
Button BackgroundColor control in the inspector. block.json default: #dc2626. Saved as `btnBg`.
Button TextColor control in the inspector. block.json default: #ffffff. Saved as `btnColor`.
LabelShared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoLabel`.
MessageShared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoMessage`.

What the front-end script actually does

When this is the right block

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

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Content Warning from the Gutenberg inserter.

Get Blockenberg