How to Dynamically Change the oEmbed Width and Height in WordPress

Web Collections
Inez Ross

$youtube = <<<EOF
<object width=”480″ height=”295″>
<param name=”movie”
<param name=”allowFullScreen” value=”true”></param>
<param name=”allowscriptaccess” value=”always”></param>
<embed src=”″
type=”application/x-shockwave-flash” allowscriptaccess=”always”
allowfullscreen=”true” width=”480″ height=”295″></embed>

The WP Guru
Marianne Foster

oEmbed is complex stuff, and WordPress uses it when you add say a YouTube URL on its own line to see how wide a video needs to be when the post is displayed. Rather than parsing the actual resource at display time, the oEmbed protocol is a handshake between your blog and the resource provider (in our example, YouTube). The site receives what the resource is and the best content for the width that’s requested.

Be the first to comment

Leave a Reply

Your email address will not be published.