Hide YouTube Related Videos
[resolved] Cache delete might not be necessary (2 posts)

  1. Justin Sternberg
    Posted 3 years ago #

    Hey man, I went about building this plugin and before submitting, I figured I'd search for one that did the same thing and found yours. Ha ha, I should have done that first. Anyway, figured I'd post the code here.
    The filter 'embed_oembed_html' is applied to the cached version of the embed, so it may be overkill to delete the cached versions.

    add_filter( 'oembed_result', 'dsgnwrks_oembed_remove_rel_video' );
    add_filter( 'embed_oembed_html', 'dsgnwrks_oembed_remove_rel_video' );
    function dsgnwrks_oembed_remove_rel_video( $result ) {
    	// append 'rel=0' to embed url
    	return str_replace( '?feature=oembed', '?feature=oembed&rel=0', $result );


  2. sparkweb
    Plugin Author

    Posted 3 years ago #

    Hey Justin, just now saw this. Whoops!

    Anyway, thanks for the code. Wouldn't your code actually add the oembed twice? I didn't realize there was an _html filter, but I'm a little leery about moving this direction without really testing it. And I'm not sure that there are really any benefits at this point. Your method may in fact be a little more efficient, but this is working well. If it stops working at some point I'll probably re-evaluate at that point.

    Thanks again for the code, I'll certainly keep it handy for the future.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.