Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Open Links in new window


_ck_
Participant

@_ck_

Well we could cheat and make the plugin skip links that have your domain name or no http:// in it.

function bb_target_blank( $text ) {
$text = preg_replace('|<a (?=http://)(?!travel-writers-exchange.com)(.+?)>|i', '<a $3 rel="nofollow" target="_blank">', $text);
return $text;
}

This is untested.

It’s a fancy regex feature called negative lookahead.

Try it and see what happens.

Doing nofollow for only externals is essentially the same thing, I’ve added it to the replacement above.Make sure you have no additional tweaks for nofollow. I don’t think it’s on by default? If so, try

remove_filter('post_text', 'bb_rel_nofollow');
remove_filter('pre_post', 'bb_rel_nofollow');

Skip to toolbar