Skip to main content
All CollectionsEmbedding and SharingWistia and WordPress
Embedding with oEmbed Links on WordPress
Embedding with oEmbed Links on WordPress

Enable link-based embedding for your WordPress site

Harper avatar
Written by Harper
Updated over 3 months ago

oEmbed is a popular format for converting embed codes into an embeddable link. On sites that support oEmbeds, the link is converted into HTML automatically, and you get a working video embed on your website. oEmbed links are available for Inline and Popover embeds.


Getting Started

Before adding Wistia oEmbeds to your pages, you must first add Wistia as an oEmbed provider in your theme's functions file.

oEmbeds use the same URL format as a Wistia media page, with embed-specific options or parameters added at the end:

From the Embed menu in Wistia, choose the Inline, Standard embed and enable Use oEmbed URL ✅ under Advanced Settings.


Add Wistia to the oEmbed provider list

This is a one-time setup step for each WP site, involving a simple edit to the `functions.php` file in the theme editor. We'll use the wp_oembed_add_provider() function from the WordPress documentation.

Simply add the following snippet to your functions.php file:
wp_oembed_add_provider(
'/https?:\/\/(.+)?(wistia.com|wi.st)\/(medias|embed)\/.*/', 'http://fast.wistia.com/oembed', true);

  • From your WordPress dashboard, navigate to Appearance > Theme Editor

  • In the Theme Files menu, find and open `Functions.php`

  • Add the Wistia oEmbed snippet to the file, on its own line. It can be added to the bottom of the file

  • Click Update File to save the changes

Add the snippet to the bottom of the functions.php file, just above the closing `?>` tag.

Example:

<?php
// Existing code in functions.php

function my_theme_enqueue_styles() {
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');

require_once get_template_directory() . '/class-wp-bootstrap-navwalker.php';

add_image_size('custom-thumb', 300, 200, true);

// Add Wistia as an oEmbed provider
wp_oembed_add_provider('https://*.wistia.com/*', 'https://fast.wistia.com/oembed', false);
?>

The Wistia WordPress Plugin

If you'd prefer not to edit the theme files yourself, the Wistia Wordpress oEmbed Plugin will automatically add Wistia to your oEmbed provider list. Simply install the plugin and you’ll be ready to start adding oEmbeds like it’s your job (which it probably is).

This plugin is actively maintained, but has not been tested with every new version of WordPress. It uses the wp_oembed_add_provider() function which has remained the same since its introduction in Wordpress 2.9 (2010). If you encounter a bug or issue with the plugin, reach out to Wistia Support!


Did this answer your question?