Skip to main content

Embedded Links in WordPress Chat: YouTube, Vimeo, and Rich Previews

· 6 min read
Creator of Better Messages

A messenger that shows a pasted URL as a plain blue link is missing one of the modern messaging UX defaults: when someone shares a YouTube link, a Vimeo video, a tweet, or a product page, the messenger should expand it into a rich preview with the image, title, and (for videos) an inline player. Better Messages has supported embedded links via WordPress's native oEmbed system since the early 1.x versions — paste a URL, the preview appears in the message; click the play button, the video plays inline without leaving the chat.

What rich previews look like

A member pastes https://www.youtube.com/watch?v=... into the composer. The message renders as:

  • The original URL (small, near the top of the message)
  • A preview card with the video's thumbnail image, title, and channel
  • A play button — click it and the YouTube player opens inline inside the chat
  • The chat continues below the player; the conversation does not need to leave the page

The same pattern works for any oEmbed-supported source — YouTube, Vimeo, Twitter / X, SoundCloud, Spotify, TikTok, Reddit, Imgur, and any source registered via WordPress's wp_embed system.

How oEmbed works in WordPress chat

WordPress core ships with the oEmbed protocol — a standard way for a content host (YouTube, Vimeo, etc.) to publish a metadata endpoint that returns an embed snippet for any URL. When a member pastes a URL into a Better Messages chat:

  1. The message text is parsed for URLs.
  2. For each URL, WordPress's oEmbed registry is consulted to find the matching provider.
  3. The plugin fetches the embed metadata (title, thumbnail, embed HTML) and renders it in the message.
  4. Results are cached server-side so repeated URLs do not hit the provider every time.

Because this uses WordPress's native oEmbed system, any oEmbed provider added by another plugin (e.g. a Spotify-embed plugin, a Twitter-embed plugin) automatically works inside Better Messages chat.

Internal product / listing previews

In addition to external oEmbed previews, Better Messages auto-expands internal site URLs into rich previews:

  • WooCommerce product URLs → product card with image, title, price, and click-to-buy
  • HivePress / Directorist / Classified Listing / Motors listing URLs → listing card with image, title, address, and price
  • LearnDash / Tutor LMS / MasterStudy LMS course URLs → course card with thumbnail, title, and instructor

This works because each integration registers itself with the messenger's URL-card detection layer. A vendor pasting their own product URL in a chat does not leave the chat to view it — the buyer sees the product card inline.

Privacy-friendly oEmbeds

Standard oEmbed loads the third-party player (YouTube, Vimeo) directly when the message renders. That means a request goes from the recipient's browser to YouTube just by them opening the chat, before they decide to play.

For privacy-conscious sites, enable Privacy-friendly oEmbeds in Better Messages → Settings → Privacy & GDPR:

  • The preview card renders with a static thumbnail + play button
  • The actual YouTube / Vimeo player loads only when the recipient clicks play
  • Until they click, no request goes to the video host

This is the right setting for GDPR-strict sites, sites with younger audiences (no third-party tracking before a deliberate click), and sites that simply care about page-load performance.

Supported providers (a non-exhaustive list)

Standard WordPress oEmbed providers, all working in Better Messages chat:

  • Video: YouTube, Vimeo, Wistia, Dailymotion, TikTok, Twitch
  • Audio: Spotify, SoundCloud, Mixcloud
  • Social: Twitter / X, Mastodon (via plugin), Reddit, Instagram (deprecated API), Facebook (deprecated API)
  • Images / GIFs: Imgur, Flickr, Giphy
  • Slides: SlideShare, Speaker Deck
  • Code: GitHub Gist (via plugin), CodePen, JSFiddle
  • Maps: Google Maps (via plugin)
  • Docs: Scribd, Issuu

Plus the internal cards for WooCommerce products and integration-specific listings / courses.

Free vs WebSocket version

Embedded links work on both versions:

FeatureFree versionWebSocket version
oEmbed previews from third-party sourcesyesyes
Internal product / listing / course cardsyesyes
Privacy-friendly click-to-play oEmbedsyesyes
Server-side embed cachingyesyes
Real-time embed rendering when a URL is pastedpollinginstant

How to enable

Embedded links are on by default. To configure privacy-friendly mode:

  1. WP Admin → Better Messages → Settings → Privacy & GDPR.
  2. Toggle on Privacy-friendly oEmbeds.
  3. Save.

To add custom oEmbed providers: register them via WordPress's wp_oembed_add_provider() in your theme's functions.php or a custom plugin. Better Messages reads from the global oEmbed registry, so any provider added there works in chat automatically.

Frequently asked questions

Will the embed work for private (members-only) YouTube videos?

YouTube's privacy settings apply at the player layer — Better Messages just renders the player, YouTube enforces access. Unlisted videos work; private videos require the viewer to be logged into a YouTube account with access.

What about Instagram / Facebook embeds?

Instagram and Facebook removed their public oEmbed endpoints in 2020. Posts from those platforms render as plain links unless you use a third-party Instagram-embed plugin that re-implements the embed.

Can members disable previews on their own messages?

Not in the default UI — every URL is auto-previewed. A custom filter can opt specific messages out, but most sites leave previews always on.

Will pasted URLs from competitors trigger previews?

The integration's URL-card detection layer matches against your own site's home URL for WooCommerce / Listing / Course previews. URLs from a different site render through the generic oEmbed path if a provider matches; otherwise they render as plain links.

Are oEmbed responses cached?

Yes — WordPress's oEmbed cache stores results per URL. Repeated views of the same URL do not re-fetch from the provider.

Does this affect end-to-end encrypted threads?

oEmbed expansion runs server-side, which means the server needs to see the URL. In an E2E thread, the URL is encrypted along with the rest of the message, so the server cannot expand it. The recipient's browser does the expansion after decryption — works, just runs client-side instead of server-side.

See also

Install Better Messages from WordPress.org →