25% off ProSNIPC25OFF

Gutenberg block

The snipcraft/snippet Gutenberg block (available with SnipCraft Pro) drops a snippet into post or page content directly from the block inserter.

Pro

The SnipCraft block requires SnipCraft Pro. Install and activate an active Pro license to use the block inserter.

Inserting a snippet

  1. Add the SnipCraft block from the block inserter (search "SnipCraft").
  2. In the block inspector panel, choose a snippet from the picker. Only enabled snippets with the shortcode scope appear in the list.
  3. Publish or update the post. The block renders the snippet server-side on the front end via the snippet renderer.
The SnipCraft Snippet block in the editor inserter: drop a shortcode-scoped snippet into any post or page.

What renders

The block executes the selected snippet server-side on each page load, honoring the snippet's type and any run-when conditions that are set on it. Snippets must use the shortcode scope to be selectable in the block; snippets in other scopes are not listed in the picker. An unset block (one where no snippet has been chosen) shows a designed empty state in the editor so it is easy to spot.

Shortcode alternative

Snippets with the shortcode scope can also be embedded using the [snipcraft id="…"] shortcode, where the value is the snippet ID shown in the SnipCraft admin. The editor's shortcode-usage panel shows all the posts and pages where a snippet is currently embedded. For the scope setting that controls shortcode and block eligibility, see snippet scopes.

Snippet scopes explains the shortcode scope that makes a snippet available to both the block and the shortcode. Snippet types covers how each code type is rendered when the block executes on the front end.