WordPress users who embed Vimeo videos with oEmbed came across a frustrating problem last week when their videos stopped working. It turns out that it’s a simple problem, with a simple solution, but no doubt it has been causing Vimeo users hours of frustration.
The Problem
WordPress Core registers Vimeo as this:
'#http://(www.)?vimeo.com/.*#i' => array( 'http://www.vimeo.com/api/oembed.{format}', true ),
However, the Vimeo API for oEmbed has the URL without the www. So this works:
http://vimeo.com/api/oembed.json?maxwidth=584&maxheight=600&url=http%3A%2F%2Fvimeo.com%2F30230507&format=json
but the former doesn’t.
Featured Plugin - WordPress Wiki Plugin
The Solution
There are two solutions to this problem with Vimeo which should get you back on track.
Code
You can add this piece of code to your functions file which will register Vimeo 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 );
}
Thanks to Brady for this solution.
Plugin
Another WordPress user has created a plugin which solves the problem. You can download the plugin from here.
WordPress are aware of this issue and a trac ticket was raised. The problem has been fixed so next time you update the problem should be solved.
I have this doubt for the last few days. But now I got satisfied answer with your post. Thanks for sharing this post.