embed_oembed_html
Filters the cached oEmbed HTML.
Usage
add_filter( 'embed_oembed_html', 'wp_kama_embed_oembed_html_filter', 10, 4 );
/**
* Function for `embed_oembed_html` filter-hook.
*
* @param string $cache The cached HTML result, stored in post meta.
* @param string $url The attempted embed URL.
* @param array $attr An array of shortcode attributes.
* @param int $post_id Post ID.
*
* @return string
*/
function wp_kama_embed_oembed_html_filter( $cache, $url, $attr, $post_id ){
// filter...
return $cache;
}
- $cache(string)
- 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.
Changelog
| Since 2.9.0 | Introduced. |
Where the hook is called
wp-includes/class-wp-embed.php 291
return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_id );
wp-includes/class-wp-embed.php 374
return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_id );
Where the hook is used in WordPress
wp-includes/default-filters.php 710
add_filter( 'embed_oembed_html', 'wp_maybe_enqueue_oembed_host_js' );