Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Open Links in new window


Sam Bauers
Member

@sambauers

The target attribute is deprecated (for those who care), use this instead:

<?php
/*
Plugin Name: Links in new window
*/
//add onclick="window.open(this.href); return false;" to post links
function bb_links _in_new_window( $text ) {
$text = preg_replace('|<a (.+?)>|i', '<a $1 onclick="window.open(this.href); return false;">', $text);
return $text;
}
add_filter('pre_post', 'bb_links _in_new_window');
?>

Skip to toolbar