Automatically Link Twitter Usernames
If you want to automatically link twitter usernames, use the snippet below:
function snippet_twitter_replace($content) {
$twtreplace = preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/',"$1<a href="http://twitter.com/$2" target="_blank" rel="nofollow">@$2</a>",$content);
return $twtreplace;
}
add_filter('the_content', 'snippet_twitter_replace');
add_filter('comment_text', 'snippet_twitter_replace');
Twitter usernames in content and comments are being replaced. The username has to be something like @username.