WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Wordpress has wp_oembed_get, which I use to get rich media content with embed.ly. I've previously used oEmbed api calls such as this. As you can see it provides thumbnail_url, which I like to use instead of embedding the video. How can I do this with wordpress?


share|improve this question
up vote 8 down vote accepted

Use the oembed_dataparse filter to modify the resulting HTML output by any given oembed call.



function test($return, $data, $url) {
    if ($data->provider_name == 'YouTube') {
        return "<img src='{$data->thumbnail_url}'>";
    else return $return;

Then putting this in a post:


Will give you a picture of Rick Astley instead of a flash video of him. :)

Edit: Note that WordPress caches oEmbed results in postmeta. So after making your code, you'll have to go and Update a post for it to know to go re-get the oEmbed data and have code like this take effect. In case you want to do testing and such.

share|improve this answer
Thanks, Otto! Can you explain what each argument does ($return, $data, $url)? The reason why I ask is because I'm not implementing this in shortcode but rather in my template. – FLX Jun 9 '11 at 12:48
$return is the normal HTML that the oEmbed process would return. $data is the data received from the oEmbed call to their server, in an object format. $url is the original URL being queried for oEmbed info. – Otto Jun 10 '11 at 15:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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