apply_filters( 'embed_oembed_html', mixed $cache , string $url , array $attr , int $post_ID )
Filters the cached oEmbed HTML.
Description Description
See also See also
Parameters Parameters
- $cache
-
(mixed) The cached HTML result, stored in post meta.
- $url
-
(string) The attempted embed URL.
- $attr
-
(array) An array of shortcode attributes.
- $post_ID
-
(int) Post ID.
Source Source
Changelog Changelog
Version | Description |
---|---|
2.9.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Note that https://developer.wordpress.org/reference/hooks/embed_oembed_html/#comment-1964 very incorrectly assumes that every oEmbed response contains a video, and even more incorrect raises the expectation that every oEmbed response has the same aspect-ratio.
Please never copy/paste the example as-is into your theme. Especially not when the theme is intended to be re-used/sold. It is killing oEmbed.
Feedback
Only want to filter YouTube and Vimeo? User this instead:
Props to Dave Romsey on StackExchange. — By Matt Radford —
Wrap oEmbed in a div. Useful for making video responsive, for example.
I wish I had known before I implemented code on this hook that JetPack overrides and doesn’t reimplement the filter. If you hook anything to this be sure you won’t be using JetPack or it won’t work. https://github.com/Automattic/jetpack/issues/1571
Feedback
Use this filter if Jetpack is activated.
add_filter('video_embed_html', 'wrap_embed_html'); // Jetpack
— By Matt Radford —