apply_filters( 'oembed_result', string|false $data, string $url, string|array $args )

Filters the HTML returned by the oEmbed provider.


Parameters

$data string|false
The returned oEmbed HTML (false if unsafe).
$url string
URL of the content to be embedded.
$args string|array
Additional arguments for retrieving embed HTML.
See wp_oembed_get() for accepted arguments. Default empty.
More Arguments from wp_oembed_get( ... $args ) Additional arguments for retrieving embed HTML.
  • width int|string
    Optional. The maxwidth value passed to the provider URL.
  • height int|string
    Optional. The maxheight value passed to the provider URL.
  • discover bool
    Optional. Determines whether to attempt to discover link tags at the given URL for an oEmbed provider when the provider URL is not found in the built-in providers list. Default true.

Top ↑

Source

File: wp-includes/class-wp-oembed.php. View all references

return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );


Top ↑

Changelog

Changelog
Version Description
2.9.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Andis

    In case you are wondering why this filter does not work for you:
    The oembed_result filter is applied before the oEmbed response is cached as _oembed_* meta entry in the postmeta table.
    If you want to always modify the oembed HTML, you should look at embed_oembed_html filter.
    However, using the `embed_oembed_html` filter may reduce site’s performance, because it is called on every page load for every embed URL.

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