1

I am trying to embed a Vimeo video into a post. I am inserting the URL into the page like so.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

http//vimeo.com/1234

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

It is outputted as the plain text URL. I have tried it with a youtube link and it worked perfectly. I have also tried wrapping it in the [embed] shortcode but that just wrapped it in anchor tags.

Any suggestions would be much appreciated, thanks.

1 Answer 1

3

Looking into WordPress Core vimeo is registered like so:

'#http://(www\.)?vimeo\.com/.*#i' => array( 'http://www.vimeo.com/api/oembed.{format}', true  ),

But looking at vimeo API for oEmbed they show their URL without the www. so what you need to do is register vimeo oEmbed correctly:

add_action( 'init', 'add_vimeo_oembed_correctly' );
function add_vimeo_oembed_correctly()
{
    wp_oembed_add_provider(
        '#http://(www\.)?vimeo\.com/.*#i',
        'http://vimeo.com/api/oembed.{format}',
        true
    );
}

You can place this in your theme functions file or place in a plugin.

You may need to revisit posts that have Vimeo embeds and save again after putting this fix in.

2
  • Thank you. I inserted it into my init hook and it worked perfectly. I did not have any previous embed links so I do not know if you have to click update on all of your posts. I would imagine it is a filter on echo, not on save.
    – Wolfy87
    Commented Oct 13, 2011 at 11:43
  • WP 3.3 Beta 1 works without the www. now. Commented Oct 19, 2011 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.