apply_filters( 'embed_defaults', int[] $size, string $url )

Filters the default array of embed dimensions.


$size int[]
Indexed array of the embed width and height in pixels.
  • int
    The embed width.
  • 1 int
    The embed height.
$url string
The URL that should be embedded.

Top ↑

More Information

  • If the theme does not specify a content width, then 500px is used. The default height is 1.5 times the width, or 1000px, whichever is smaller.
  • The callback function is expected to return an array of embed width and height in pixels.

Top ↑


File: wp-includes/embed.php. View all references

return apply_filters( 'embed_defaults', compact( 'width', 'height' ), $url );

Top ↑


Version Description
2.9.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Steven Lin

    Example migrated from Codex:

    Modify the default embed dimensions by adding the filter to the functions.php file of a child theme.

    add_filter( 'embed_defaults', 'modify_embed_defaults' );
    function modify_embed_defaults() {
        return array(
            'width'  => 750, 
            'height' => 375

You must log in before being able to contribute a note or feedback.