It’s tempting to simply hide YT containers, but a lot of videos on one page will bork page loading, so it’d be better to truly remove these. Perhaps use “the_excerpt” or “the_content” filters to identify YT links and remove them. What’s actually removed depends on how the video was inserted to begin with and whether the oEmbed and shortcode filters have already run or not. It’s probably better to hook your filter early and look for raw YT links and shortcodes that occur before oEmbed and do_shortcode() run. You may want to also search for full YT iframes to be thorough.
The main challenge here is coming up with the right regexps that reliably extract YT embeds in whatever form they may occur. It’s actually easier to hook late because the only thing to find would be the full YT iframe, but it’s less efficient because oEmbed and do_shortcode() introduce a decent bit of overhead, only to be undone.
]]>