• Hey all, I’m looking to find a way to disable (or otherwise constrain) youtube videos on the blogroll. While listing several blog posts embedded youtube videos are breaking outside the boundries of the element they are in.

    I’d rather just disable videos unless someone actually clicks on the post.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Disable Youtube Videos on Blog roll?’ is closed to new replies.