Add twitter username to shared tweets

The following code snippet will add your twitter username to the end of a tweet shared from your website.

Make sure to change “billerickson” to your twitter username.

This code snippet goes in a core functionality plugin or Code Snippets.

 * Shared Counts - Add username to twitter share
 * @see
 * @author Bill Erickson
 * @param array $link
 * @return array
function be_shared_counts_twitter_username( $link ) {
	if( 'twitter' == $link['type'] ) {
		$link['link'] .= '&via=billerickson';
	return $link;
add_filter( 'shared_counts_link', 'be_shared_counts_twitter_username' );

Filters used:

Published by Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.