WP Oembed not passing through the “autoplay=1” variable

Those are not really arguments like for YouTube, more of arguments for WordPress itself.

One way to handle it would be to access your argument later inside of a filter and modify HTML output.

Pass in arguments array:

wp_oembed_get( 'http://www.youtube.com/watch?v=', array( 'autoplay' => 1 ) );

And filter:

add_filter('oembed_result','oembed_result', 10, 3);

function oembed_result($html, $url, $args) {

    // $args includes custom argument
    // modify $html as you need

    return $html;
}

Leave a Comment