Support » Plugin: Hide YouTube Related Videos » Cache delete might not be necessary

  • Resolved Justin Sternberg


    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 );

Viewing 1 replies (of 1 total)
  • Plugin Author sparkweb


    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Cache delete might not be necessary’ is closed to new replies.