Re: Open Links in new window
Try this simpler version:
function bb_target_blank( $text ) {
$text = preg_replace('|<a (.+?)>|i', '<a $1 target="_blank">', $text);
return $text;
}
add_filter('pre_post', 'bb_target_blank');
EDIT 22 December 2009. bbPress is stripping the $1 out of the code above. It goes between the ‘a’ and the ‘target’ where you can see two spaces. See here: