embed_defaults WordPress Filter Hook

The embed_defaults hook allows you to modify the default width and height for oEmbed objects. This is useful if you want to make sure that all oEmbed objects are the same size.

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

Filters the default array of embed dimensions.


Parameters

$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 ↑

Source

File: wp-includes/embed.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.