Skip to content

Shortcode Reference

SnipShare overviewPremiumGet SnipShare →

SnipShare provides a [snipshare] shortcode that embeds a syntax-highlighted code viewer inline in any WordPress post, page, or widget.


[snipshare hash="abc123"]

Replace abc123 with the paste’s share_hash (visible in the paste URL: /paste/abc123).


Attribute Type Default Description
id integer 0 Paste ID (numeric). Embeds public pastes only. Alternative to hash.
hash string '' Paste share_hash. Required for unlisted pastes. Alternative to id.
file string '' Filename to display for multi-file pastes. If omitted, all files are shown.
lines string '' Line range to display, e.g. 5-20. If omitted, all lines are shown.
height integer '' Maximum height in pixels. Adds vertical scrolling when content overflows.

Either id or hash must be provided.


[snipshare hash="abc123"]
[snipshare id="42"]

Show only one file from a multi-file paste

Section titled “Show only one file from a multi-file paste”
[snipshare hash="abc123" file="helper.php"]
[snipshare hash="abc123" lines="10-25"]
[snipshare hash="abc123" height="300"]
[snipshare hash="abc123" file="index.js" lines="1-50" height="400"]

The shortcode outputs a <div class="snipshare-embed"> containing:

  • A header bar with the paste title (linked to the paste page)
  • Per-file headers (only shown for multi-file pastes)
  • <pre> blocks with Prism.js syntax highlighting classes

Prism.js assets are enqueued only when the shortcode is rendered. The theme follows the Appearance → Code Theme setting.


Paste type Shortcode output
Public Renders normally with id or hash
Unlisted Renders with hash only. id shows “Paste not found.”
Private (author or moderator viewing) Renders normally
Private (anyone else) Shows: “Paste not found.”
Password-protected Always shows a locked placeholder with an “Open paste” link. Shortcodes never unlock.
Burn-after-read Never embedded. Shows a placeholder with a “View paste” link.
Not found / expired / trashed Shows: “Paste not found.”

SnipShare shortcodes work natively inside bbPress topics and replies because bbPress runs do_shortcode() on its content by default. No extra configuration is needed.

The Insert Paste button (when enabled in Settings → Integrations) makes it easy for users to insert shortcodes without knowing the syntax.


  • The shortcode is self-closing - content between opening and closing tags is ignored
  • lines attribute uses 1-based line numbering (line 1 = first line)
  • When file does not match any filename in the paste, the first file is displayed instead
  • The height attribute applies a max-height CSS style with overflow-y: auto