add_filter to youtube embeds?

Yes, there is a filter for Oembeds. Two (or even more) in fact: oembed_result will be called before it is put in the cache (so only once per external embed), and embed_oembed_html after the cache (so every time the item is displayed). If you only need to modify it once, oembed_result is probably your friend. The second parameter is the $url, so check whether it comes from Youtube before you do something.

Leave a Comment