Skip to main content

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

· 7 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 previews#

One integration goes further than oEmbed: WooCommerce. Paste a product or cart URL from your own shop and the message renders it as a product card rather than a bare link, so a vendor answering a question about an item does not send the buyer away from the conversation to see it.

That is the only internal card. Listing and course integrations — HivePress, Directorist, Classified Listing, Motors, LearnDash, Tutor LMS, MasterStudy — put a Live Chat button on the listing or course rather than a card in the message. A pasted listing URL stays an ordinary link. If you want previews for those, WordPress's own oEmbed discovery will pick them up for any post type whose template publishes an oEmbed endpoint.

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:

  • YouTube, Vimeo, DailyMotion and VideoPress render as a static thumbnail with a play button. The real player loads only when the recipient clicks, so until then no request reaches the video host.
  • Every other provider — SoundCloud, Flickr, Spotify, the rest — is shown as a plain link, not a click-to-play card. There is no thumbnail to serve without contacting them, so they are not contacted at all.

That second half is the trade-off worth knowing before you switch it on: it is stricter than "click to load", and a site that leans on Spotify or SoundCloud previews will notice. It is the right setting for GDPR-strict sites, sites with younger audiences, and sites that care about page-load weight.

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
WooCommerce product cards for your own shop URLsyesyes
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 WooCommerce product card only matches URLs on your own shop, so a competitor's product link never renders as one of your cards. It still goes through the generic oEmbed path — if that site publishes an oEmbed endpoint, a preview appears. Otherwise it stays a plain link. If you would rather no external preview appeared at all, Privacy-friendly oEmbeds is the blunt instrument for it.

Are oEmbed responses cached?#

Yes — the fetched result is stored in the message's own meta, keyed by a hash of the URL, so a link is fetched once for that message and repeated views never re-fetch from the provider.

Does this affect end-to-end encrypted threads?#

Yes, and not in a way that has a workaround. oEmbed expansion runs server-side, and in an E2E thread the server only ever sees ciphertext, so it has no URL to expand. There is no client-side oEmbed fetcher either — the browser renders the embed markup the server produced, and for an encrypted message there is none. Links in encrypted conversations stay plain links.

See also#

Install Better Messages from WordPress.org →