Chris W. Smith

  • About Me
    • Past Work
  • Tools
  • Blog
  • Contact

Adding Wistia as an oEmbed Provider in WordPress 4.0 & WordPress 4.1

September 4, 2014 By Chris Smith 7 Comments

(originally posted on Bring Your Own Design)

With today’s WordPress 4.0 sendout, embedding content from other sites just got way easier. While there is a pretty large list of oEmbed providers, a very important one for us SEOs was left out: Wistia. Don’t worry, though. There is a way to make Wistia videos work the same was with a simple paste of the video URL, much like a YouTube video works.

In your theme’s functions.php, paste the following code:

wp_oembed_add_provider( '/https?://(.+)?(wistia.com|wi.st)/.*/', 'https://fast.wistia.com/oembed', true );

This will let you take the native Wistia video URL, and have the video show up in the Visual editor for easier formatting of the post. It’ll take this:

https://fluiditservices.wistia.com/medias/5yltawbi5t

…and turn it into this (it’s a video from one of our spectacular clients!):

Have any questions? Let us know in the comments!

Filed Under: Code Snippets Tagged With: code, oembed, wistia

Comments

  1. Dan Rollins says

    September 5, 2014 at 5:40 pm

    THank you for this information Chris! I am comfortable with customizing WP but far from a PHP guy, so, question for you. I just replicated what you instructed (for those like me, I had to paste the code referenced above inside , at least it seemed to have worked).

    So when I did that and tested a post it seemed to act like it was working, then when I previewed the post it gave me a php error in line XXX. Is this because I have a CNAMED Wistia URL? Instead of http://livewirefilms.wistia.com my account URL is http://library.livewirefilms.com

    Any word of advice to get this working? Thanks so much!
    Dan Rollins

  2. Admin says

    September 6, 2014 at 1:20 pm

    Dan,

    Try:

    wp_oembed_add_provider( '/https?://(.+)?(livewirefilms.com)/.*/', 'https://fast.wistia.com/oembed', true );

    My Regex is rusty, but I think that should work.

  3. Dan Rollins says

    September 8, 2014 at 5:49 pm

    Thank you for the info! Didn’t work. I added the code you replied with and it didn’t work. I then also added the original one from your post and that didn’t work. However, I do have a NON CNAMED Wistia account and I tried that and it in does fact work. So, looks like a CNAMED account is the issue, which is a huge bummer because that is my main account.

    Any other ideas on a solution for that?

    Thanks again!
    Dan

  4. Admin says

    September 8, 2014 at 5:51 pm

    Can you post a link to a video from that account?

  5. Dan Rollins says

    September 9, 2014 at 5:36 pm

    Here are both.

    My primary CNAMED account: http://library.livewirefilms.com/medias/bbv4v2f182
    My selectively used “regular” account: https://livewire.wistia.com/medias/y5lwn6ybm9

    Thx,
    Dan

  6. Admin says

    September 12, 2014 at 1:31 pm

    Ah, I see what the problem is. Wisita, for some reason, doesn’t use HTTPS for the CNAMED addresses. So, you can simply add the ‘s’ to the URL before pasting it into the post screen.

    The alternative is change the HTTPS to HTTP in the function. I’m sure there’s a regex way to do it, but I’ll have to spend some time on it to get that right. I’ll try to update once I figure that out.

  7. Gareth says

    March 28, 2015 at 10:28 am

    Hi Chris

    Just building a full wistia integration plugin if you would like to test it out

    http://www.seo-doctor.co.uk/wistia-dashboard-for-wordpress.html.

    Just adding the analytics dashboard at the moment.

    Gareth

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Latest Posts

  • Keyword Research Using Python, RAKE, and Support Chat Transcripts June 16, 2017
  • No Title June 16, 2017
  • Premixed Old Fashioneds May 3, 2017
  • Downstairs Bathroom Renovation March 8, 2017
  • Testing Android January 9, 2017
  • About Me
  • Tools
  • Blog
  • Contact

Copyright © 2022 · Built with the Genesis Framework on WordPress