The WP Coder Snippet block puts a snippet into a post or page in the block editor. When the snippet has attributes, the block shows them as fields in its sidebar — so editors change text, images and options without touching the code.
Adding the block#
- In the block editor click + and search for WP Coder Snippet (or type
/wp coder). - Pick the snippet in the Snippet list (search by title) and click Load Preview. In the free WP Coder, type the snippet’s ID and click Load Preview.
- The preview shows the snippet with its CSS, exactly as on the site.
Block settings#
The WP Coder Settings panel in the block sidebar:
| Setting | What it does |
|---|---|
| Snippet ID | The snippet this block shows. Change it to switch the block to another snippet. |
| Auto-reload Preview PRO | On: the preview updates when you leave a field. Off: click Reload Preview to update it. |
| Hide from visitors PRO | Only administrators see this block on the site; visitors get nothing — no HTML, CSS, JS, image preloads or Remove rules. It stays visible in the editor. Handy for drafts of a section on a live page. |
| Reload Preview | Re-render the preview now. |
| Edit Snippet | Open the snippet in a new tab. |
Below them, a panel lists the snippet’s attributes as fields — Shortcode Attributes in the free WP Coder, Attributes with labels and help text in Pro.
In WP Coder Pro PRO: with Click to edit on, fields that show nothing in the current preview are listed above the panel under Not in the preview — empty, hidden by a condition, or used only in CSS or PHP. If you add a field to the snippet while the post is open, switch back to the editor tab: the block’s fields refresh by themselves.
Why is the preview empty?#
The snippet is switched off, or it printed nothing with the current values. In WP Coder Pro the preview says why — including no active licence — and a snippet hidden by a visitor condition (guests only, URL, schedule…) still renders in the editor, with a notice naming the condition.
Editing tools on the toolbar PRO#
Two optional buttons on the block toolbar help when you write the snippet’s CSS or look for a field. Turn them on in Tools → Developer:
- Click to edit (Block Field Picker) — hover the preview to see which field fills each part; click to open that field in the sidebar, Repeater rows included. Hovering a field in the sidebar outlines what it fills.
- Inspector (Block Inspector) — hover elements to see their tag and classes; click to copy a CSS selector.
Block or shortcode?#
Both show the same snippet with the same values.
| Block | Shortcode | |
|---|---|---|
| Editing values | Fields with labels, pickers, preview | Typed by hand: [wp_code id="12" heading="Hi"] |
Characters like [ ] in values |
Work | ] ends the shortcode |
| Works in | The block editor | Classic editor, widgets, page builders, theme templates via do_shortcode() |
Visitor conditions still apply#
The block prints the snippet where it is placed — Display can stay Shortcode or block only. But the snippet’s Test mode — and in Pro its visitor conditions (users, schedule, device, browser, URL…) — still decide who sees it.