I'm working on a widget that embeds videos using oEmbed and I'm testing it out using the default providers in WordPress. So far, they are all working fine, except Viddler. The video is displayed, but not with the width and height I specified.

To get the oembeds to work properly in the widget, I'm using the wp_oembed_get() function, which requires the video's URL and optionally an array with the width and height.

// Test Data:
$url = 'http://www.viddler.com/v/bdce8c7';
$width = '250';
$height = '140';

echo wp_oembed_get( $url, array( 'width' => $width, 'height' => $height ) );

This yields a video with dimensions of 620 x 349. I've hacked a way around it, but wp_oembed_get() is supposed to be able to do all this for me, right? Here's what I've put together:

require_once( ABSPATH . WPINC . '/class-oembed.php' );

// $service is detected by parsing the URL for the host
if ( $service == 'viddler' ) {

    $oem    = _wp_oembed_get_object();
    $json   = 'http://www.viddler.com/oembed/?format=json&url=' . urlencode( $url );
    $return = $oem->fetch( $json, $url, array( 'width' => $width, 'height' => $height ) );
    $oembed = $return->html;

} else {

    $oembed = wp_oembed_get( $url, array( 'width' => $width, 'height' => $height ) );


return $oembed;

This works, but I'm wondering if this is a bug I should report to WP or Viddler. In the WP Core (wp-includes/class-oembed.php), the URL format for Viddler is:


Should that be changed to what I have above?


Anyone else having this issue?

1 Answer 1


Yes, seems that viddler changed their oembed endpoint, and the redirection from the old one is stripping the maxwidth.

I made a core ticket about the issue: http://core.trac.wordpress.org/ticket/24296


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.