Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open external links inside WordPress comments in a new tab/window
@llandrew

This comment has been minimized.

Copy link

commented May 20, 2016

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
You can’t perform that action at this time.