Skip to content

Instantly share code, notes, and snippets.

@roytanck
Created April 1, 2015 14:08
Show Gist options
  • Save roytanck/7f0392386914aa2adfb2 to your computer and use it in GitHub Desktop.
Save roytanck/7f0392386914aa2adfb2 to your computer and use it in GitHub Desktop.
Open external links inside WordPress comments in a new tab/window
@llandrew
Copy link

Love the gist. One thing I noticed is that when it runs through the first bit, it will add an errant target="_blank", so I added
if ( strpos( $bit, 'href' ) === false ) continue;
after the foreach opening and that seems to fix it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment