oEmbed
SnipShare implements the oEmbed 1.0 specification as a provider. Any oEmbed-aware consumer - including WordPress itself, Slack, and other platforms - can embed SnipShare pastes automatically.
Licence: oEmbed and the embed endpoints are public on every licence tier, so other sites, Slack and social link previews can embed public pastes. Pasting one of this site’s own paste URLs into a post, BuddyPress activity or a bbPress topic is resolved in-process, without an HTTP request back to the site.
oEmbed Endpoint
Section titled “oEmbed Endpoint”GET /wp-json/snipshare/v1/oembedParameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url |
string | Required | The full URL of a paste page (e.g., https://yoursite.com/paste/abc123) |
format |
string | json |
Response format. Only json is supported. |
maxwidth |
integer | 600 |
Maximum iframe width in pixels. Clamped to 300–800. |
maxheight |
integer | 400 |
Requested maximum height. Ignored - height is calculated from paste content. |
Example Request
Section titled “Example Request”curl "https://yoursite.com/wp-json/snipshare/v1/oembed?url=https%3A%2F%2Fyoursite.com%2Fpaste%2Fabc123&format=json"Example Response
Section titled “Example Response”{ "version": "1.0", "type": "rich", "provider_name": "My WordPress Site", "provider_url": "https://yoursite.com", "title": "My Paste Title", "author_name": "admin", "author_url": "https://yoursite.com/pastes/user/admin/", "html": "<div ...><iframe src=\"...\" ...></iframe><a ...>View paste →</a></div>", "width": 600, "height": 300}The html field contains an <iframe> pointing to the paste embed view (/paste/{hash}?embed=true) with a link beneath it.
Auto-Discovery
Section titled “Auto-Discovery”SnipShare injects an oEmbed discovery <link> tag into the <head> of every single paste page:
<link rel="alternate" type="application/json+oembed" href="https://yoursite.com/wp-json/snipshare/v1/oembed?url=...&format=json" title="SnipShare oEmbed" />This lets any oEmbed-aware consumer (including WordPress) discover the endpoint automatically by reading the paste page - no manual provider registration needed.
Within WordPress
Section titled “Within WordPress”SnipShare registers itself as a WordPress oEmbed provider via wp_oembed_add_provider(). This means:
- Pasting a paste URL on its own line in the WordPress block editor auto-embeds it as an inline code viewer
- BuddyPress activity feed: paste URLs in activity posts are auto-embedded (when
bp_inithook runs) - bbPress topics/replies: paste URLs are auto-embedded when Paste Embeds is enabled in Settings → Integrations
Embed View
Section titled “Embed View”The embed template (/paste/{hash}?embed=true) is a stripped-down page that renders just the code viewer - no site header, footer, or navigation. It is safe to use inside an <iframe> with the sandbox="allow-scripts allow-popups" attribute.
Height is calculated automatically based on the number of lines in the largest file, clamped between 150px and 500px.
Access Control
Section titled “Access Control”| Paste type | oEmbed behaviour |
|---|---|
| Public | Exposed via oEmbed |
| Unlisted | Exposed via oEmbed (URL-based access is intentional) |
| Private | Returns 404 - private pastes are never exposed via oEmbed |
| Password-protected | Returns the embed. The iframe shows a locked placeholder with a “View paste” link, never the code |
| Burn-after-read | Returns 404 - burn pastes are never exposed via oEmbed |
| Expired / Trashed | Returns 404 |
Embeds and oEmbed never unlock or reveal a paste: unlocking and revealing only happen on the paste page itself.
- The endpoint is public - no authentication required
format=xmlis not supported; the endpoint always returns JSONmaxwidthis clamped: minimum 300px, maximum 800px- The iframe uses
sandbox="allow-scripts allow-popups"for security

