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
- Add the SnipCraft block from the block inserter (search "SnipCraft").
- In the block inspector panel, choose a snippet from the picker. Only enabled snippets with the shortcode scope appear in the list.
- Publish or update the post. The block renders the snippet server-side on the front end via the snippet renderer.
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.
Related
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.