Function: get_post_embed_html

get_post_embed_html( integer $width, integer $height, integer | WP_Post $post )

Retrieves the embed code for a specific post.


Name Type(s) Default Value Description
$width integer

The width for the response.

$height integer

The height for the response.

$post integer | WP_Post null

Optional. Post ID or object. Default is global $post.


string | false

Embed code on success, false if post doesn't exist.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.